Java Itext PDF - Can I change the input line of the AcroFields? - java

I'm Currently mapping a PDF form using itextpdf, version: 5.5.13.1
Problem: When I edit the mapped PDF using any editor as Acroba Pro or Foxit, the field text line change.
Q: Can I make the mapping line-height the same as the PDF editors.
Edit: Below two screenshots, you can see when I edit the field the line-height change. I added the line under the text to show the difference.
Before the edit ==>
After the edits ==>

Related

PDF is getting change after loading using PDFBOX jar

I have a PDF having first page as different page ( as we have in MS word functionality under "Design" tab ). and the same PDF is passed to PDFBOX using below code :
File originalPdfFile = new File("D:\\AsposeOutput_temp.pdf");
PDDocument originalDocument = PDDocument.load(originalPdfFile);
originalDocument.save("D:\\pdfBoxGen.pdf");
But when i am opening the PDF that is generated by PDFBOX, is modified. I have attached the input PDF (named AsposeOutput_temp.pdf) and output PDF (named : pdfBoxGen.pdf). I want the PDF to same as i am passing as input.
File links : https://gofile.io/?c=lLPpQz
Any help would be greatly appreciated!!
I got the solution for the above problem. There was no issue with PDFBOX library. it was with the Aspose word.The input file that was passed to PDFBOX library , was having section break internally and the same was making the improper alignment of footer.

How to update table of content (TOC) for docx file by apache poi

How to update table of contents (TOC) and then convert docx file to pdf?
I want to create and update table of content in docx file and then convert it to pdf, so I want this TOC to be updated in pdf file.
This code update TOC after opening docx file by user and I don't need it.
docx.enforceUpdateFields();
I want TOC to be updated automatically by my program. Thanks.
Based on comment in this link, I found out that there is no way to update TOC automatically. Ben said on that comment "It then relies on a user to open the document in Word to generate the actual table of contents. Unfortunately, Word can't be made to update the TOC automatically and without user interaction".

Skip the content while HTML to Excel conversion using aspose.cell in Java

I want to convert the HTML to Excel using aspose cell in Java, but the generated Excel skipping the content.
HTML content :
Hi Fanny,
Urgent !! 
SPR'17 - S/545175 -- ADSO# 16843754;
SPR'17 - S/545175 -- ADSO# 16843754;
fdzjchxk;shdgasz;ASDO;fhsjdzx
dyzhbsxz;sdhbdugvfd;36457q;sfdnzcx;
Best regards
Tel: 0123-1234 8765
Generated Excel file content :
SPR'17 - S/545175 -- ADSO# 16843754;
I am using aspose cells-16.12.0.jar and there is not any error occurring. The Content doesn't has any image or table etc but have special symbol. The code is executing fine without any error. I feel special symbol is creating the problem.
Aspose.Cells supports to read/write MS Excel-oriented HTML file, it means, you got to use only those HTML tags which MS-Excel uses in the formation of the file. I guess your template HTML is not good. I think you may try to open the HTML file into MS-Excel first to check if it is opened fine or not. If MS Excel opens the file fine then Aspose.Cells APIs should be able to read it fine.

POI enable different header/footer for the first page in word docx file

I'm generating a docx file using Apache POI 3.13 and I stuck with headers/footers for first page.
I create XMPFParagraph[] without any problem. Next I create headers and footers like this (I've tried in different oreder):
policy.createHeader(XWPFHeaderFooterPolicy.DEFAULT, defaultHeader);
policy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, defaultFooter);
policy.createHeader(XWPFHeaderFooterPolicy.FIRST, firstHeader);
policy.createFooter(XWPFHeaderFooterPolicy.FIRST, firstFooter);
Once I generate my docx file I could see my default header/footer on every page including first one. But if I select to use different header/footer for the first page - my first header and footer apperes correctly.
How could I make this happens automaticaly via code? And is there any appropriate documentation with examples about POI?
If you want to set a first page header in a section, you must enter a title page tag in section properties tag (w:sectPr). The title page tag can be empty, but it is necessary. In your case, you can add only 2 code lines:
CTSectPr sect = document.getDocument().getBody().getSectPr();
sect.addNewTitlePg();
`Best regards!

Print Jasper Report without pages

I'm creating HTML (popup window), EXCEL and PDF report and would like to show my reports on one page. This report is not going to be used for printing, so there is no need separate my report into pages. Plus later users would like to use Buildin Excel sorting.
Is there an option to ignore pages?
Toggle pagination during report filling. For example, Excel or HTML output should not be paginated. Sample code:
parameters.put(JRParameter.IS_IGNORE_PAGINATION, true);
JasperPrint print = JasperFillManager.fillReport(report, parameters, data);
Under the Report Properties in the "More . . ." section. There is a Ignore Pagination option. Check this box and it should work
I don't know if there an option to ignore pages, but you can change the page height to a very big number (10000)?
In the XML, set the pageHeight attribute to "10000", or similar.
As an alternative to checking "Ignore pagination", you should be able to get a similar effect by setting the page bands' height to zero. At least for Excel and HTML reports, not sure about PDF.
This is helpful for large reports when you want to use Jasper's Virtualizer feature. The reason is that the virtualizer stores entire pages on disk, and if you enable ignore pagination, you will not get the benefit from the virtualizer and risk running out of memory.
My project is using net.sf.jasperreports.engine.JasperReport ver 3.6.1 to generate csv file and surprisingly I see the csv output file is inserted with alternate ,,1,,, and ,,9,,, at every 42nd line.
Refer here: http://jasperreports.sourceforge.net/sample.reference/nopagebreak/
I added the following setting in the jrxml template
<jasperReport ... isIgnorePagination="true" ...>
...
</jasperReport>
and the empty line is gone.

Categories

Resources