Hi,
it looks like you are adding each page twice to the document, one time in
"addNewPage" and second time within the loop.
BR
Andreas Lehmkühler
Am 14.10.2014 um 17:07 schrieb [email protected]:
Using this code:
--------------------------------------------------------------
...
try {
pdDocument = new PDDocument();
...
PDPage pdPage = null;
PDPageContentStream pageContentStream0 = null;
for (String key: manifestKeySet) {
//if (manifestCounter >= 2) {
// break;
//}
Manifest manifest2 =
afterCleaningManifestTreeMap.get(key);
// Landscape mode (90 degrees rotation)
pdPage = addNewPage(pdDocument, PDPage.PAGE_SIZE_A4,
90);
//pdPageArrayList.add(pdPage);
pageContentStream0 = new
PDPageContentStream(pdDocument, pdPage);
.................
// Close Streams and save PDF
pageContentStream0.close();
pdDocument.addPage(pdPage);
++manifestCounter;
} // end for Manifests
StringBuilder fullPathToPdf = new StringBuilder(pathToPdfDir);
fullPathToPdf.append(File.separatorChar);
fullPathToPdf.append(pdfNameSB.toString());
// eg, .pdf
fullPathToPdf.append(props.getPdf_name_suffix());
pdDocument.save(fullPathToPdf.toString());
System.out.println("The PDF called " + pdfNameSB.toString()
+ " has just been generated...\n");
generatedPdfPath.add(fullPathToPdf.toString());
pdDocument.close();
---------------------------------------------------------------------------------
private PDPage addNewPage(PDDocument doc, PDRectangle rect, int rotation) {
PDPage page = new PDPage(rect);
// Put in landscape mode
page.setRotation(rotation);
doc.addPage(page);
return page;
}
---------------------------------------------------------------------------------
----- Mail original -----
De: "Maruan Sahyoun" <[email protected]>
À: [email protected]
Envoyé: Mardi 14 Octobre 2014 17:01:51
Objet: Re: Multiple PDPages not displayed correctly on Windows
OK - the file is not OK e.g. it has multiple time Page 2, Page 3 ..
How did you create it?
Maruan
Am 14.10.2014 um 16:54 schrieb [email protected]:
I use Acrobat Reader XI.
Here's a hyperlink to the PDF: http://www.filedropper.com/1413298361249
Cheers,
Philippe
----- Mail original -----
De: "Maruan Sahyoun" <[email protected]>
À: [email protected]
Envoyé: Mardi 14 Octobre 2014 16:42:15
Objet: Re: Multiple PDPages not displayed correctly on Windows
Hi Philippe,
which Reader are you using on Windows. Could you share a file (upload it to a
public location as the mailing list doesn’t allow attachments).
BR
Maruan
Am 14.10.2014 um 16:35 schrieb [email protected]:
Hello,
I have written a Java program that generates a PDDocument containing several
landscaped PDPages.
Whereas, on Centos, all pages are correctly displayed in the PDF Reader
(Document Viewer), on Windows, only page 1 is OK (the other pages are show as
tiny squares).
Any help with this issue would be greatly appreciated.
Best regards,
Philippe