Free Support Forum - aspose.com

PDF printing issues due to invisible added content

Hello,

we currently run into printing issues (evaluated with callas pdfToolbox - digital print (b/w)) in combination with aspose.pdf 3.3 for java. Apparantly, there is some content inserted with 0pt fontsize in every generated pdf leading to problems in the post processing.

I have attached a demo pdf file (Test.pdf) and a screenshot from the output of the callas evaluation (Test_eval.png, blue cross). If a pdf is created without any content the occuring invisible ‘dot’ is associated with the defined default font size (e.g. 12pt). I have also attached pdf and evaluation result for this case. Is there any possibility to avoid this kind of embedded content or at least to avoid occurence of 0pt fontsize content?

Thanks in advance!

Andreas

Hi Andreas,


Thanks for your inquiry. I’ve tested your shared Pdf and observe invisible blue cross. For further investigation I’ve generated new Pdf files using Aspose.Pdf for Java 3.3. But unfortunately I couldn’t reproduce the issue. Could you please share the sample code used to generate shared Pdf files? So we will test it at our end and provide you further information.

Sorry for the inconvenience faced.

Best Regards,

Hi,

I finally figured out that the reason for the observed behaviour was the fact that I only put content inside a footer element. Therefore the “default” section remained empty. A simple workaround for me was to add a blank text to the first section.

Here is a code snippet which should reproduce the problem:

Pdf pdf = new Pdf();
// not essential to show behaviour
pdf.setIsCoreFontUsed(false);
pdf.setDefaultFontName(“Times New Roman”);
pdf.getTextInfo().setFontSize(12);

Section sec = pdf.getSections().add();

//add this line to overcome the problem
//sec.getParagraphs().add(new Text(sec, “”));

HeaderFooter hf = new HeaderFooter(sec);
Text t = new Text(hf, “Test TEXT”);
hf.getParagraphs().add(t);
sec.setOddFooter(hf);
pdf.save(“Test.pdf”);

I guess it seems quite uncommon but in my case it’s necessary to put only content inside the footer section…

Kind regards,
Andreas

Hi Andreas,


Thanks for sharing the code snippet.

I have tested the scenario where I have tried generating the PDF file using above specified code snippet and I did not notice any issue while printing the PDF file either from Adobe Reader or while using PdfViewer class of Aspose.Pdf.Kit for Java. Can you please share some details on how I can replicate the printing related issue.

We are really sorry for your inconvenience.


[Java]

//create a PdfViewer class instance.<o:p></o:p>

PdfViewer pdfviewer = new PdfViewer();

//open a Pdf file.

pdfviewer.openPdfFile("c:/pdftest/Test (1).pdf");

//set the Pdf file page parameters, the first 1 = 100%, the second 1 is the Pdf page number.

pdfviewer.setPdfPageParameters(1, 1);

//If you want to print the Pdf file, the follow code is an example. The SimplePdfViewer shows the usage in detail.

//sets the default print scale - false.

pdfviewer.enableScalePrint(false);

//gets a printjob object.

PrinterJob printJob = PrinterJob.getPrinterJob();

//gets the default page.

PageFormat pf = printJob.defaultPage();

//sets the Paper object for this PageFormat.

// pf.setPaper(paper);

//allows user to edit settings and select printing

printJob.setPrintable(pdfviewer, pf);

//creates the printDialog.

boolean printFile = printJob.printDialog();

if (printFile)

{

printJob.print();

}

//close the Pdf file.

pdfviewer.closePdfFile();

Hi,

direct printing isn’t really the problem, I’m sorry if I wasn’t clear enough. The problem occurs in our pdf postprocessing by the application of a preflight check, which leads to an error due to the stated text section with 0pt font size.

I used callas pdfToolbox to visualize the problem to you. As mentioned above, the workaround is fine for me in the moment.

Kind regards,
Andreas

Hi Andreas,


As per my understanding the application that you are using for post processing is generating/causing the above stated issues and you did not notice any problem while printing the PDF files. May be the software that you are using has the requirement to have some contents in PDF main section so that is why it’s generating problems. Anyways, I am glad to hear that the problem seems fixed while using the workaround.

Please continue using our products and in case we can be of any further assistance, please feel free to contact.