|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
Hi, I am generating a 4-page-PDF for multiple (n) Customers. So the document length in total is like 4, 8, 12, 16 (and so on) pages long. The page footer is dynamic (company dependant) and on each page the same. But on every 4th page I don't want to have any footer (blanc).
What I tried (in vain): - "over printing" the footer with an white table cell - tried to get access to the "page number"-value
Environment: fop 1.1 xslt 1.0 Stylevison 2013
Thanks in advance für any idea.
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
It may be possible to do what you want using document sections and first/last/even/odd footers.
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
good idea - but doesn't seam to work, since it wouldn't add a new section when picking the next customer. To play around with this issue I created a demo package as attached (zipped xml, xsd and sps file) Thanxs for further ideas or hints. YoursFile Attachment(s): message_demo.zip (3kb) downloaded 154 time(s).
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
That's because you added the footers to the initial document section, not your per-company document section. File Attachment(s): example.pxf (72kb) downloaded 163 time(s).
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
sorry, can't open your pxf file. When opening Stylevision 2013 says 'unknown version' (I'm still working with stylevision 2013)
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
Then just put your footers on the secondary document section instead of the Initial Document Section.
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
Thanks for hint, but I'afraid this won't work either: result: - I have now a blanc first page (first unused section). - same footer on page 2 to 13 - only on last page my different footer.
any other ideas?
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
You probably didn't do exactly what I did in my example. Either open what I posted (using a newer version) or attach your own files once again.
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
Well, I've installed now Stylevision 2019 Enterprise (Evaluation) - so I could open your pxf-File. Now I'm facing the following problems: - solution works only with xslt 2.0 (or may be later) but not with xslt 1.0 ( this is one of my requirements) - the solution produces a blanc first page. That means printing starts with a blank page - and not with page #1, and that means that printing the whole docomunt with a duplex printer will not lead to the result, that the first sheet will contain page 1 and 2 and the second page 3 and the blanc back side.
Thank you for your input and ideas.
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
Extract the SPS from the PXF and you should be able to switch to XSLT 1.0 mode.
The blank first page is a known issue, there's nothing you can do about that.
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
Since I didn't find a way the extrakt / export / "save as" the SPS-part, I reconstructed the SPS from scratch using xslt 1.0 - so that is not the problem anymore. But from my (or users) point of view, the first blanc page is definitly a show stopper.
However - thanks for your input.
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
Maybe post-process the PDF, then? Perhaps there's some command-line tool you can use to delete the first page of a PDF.
|
|
Rank: Member
Joined: 9/23/2011 Posts: 15 Location: Germany
|
Yes indeed, that's was I did meanwhile: I extended the java program (pdfStamper- library) to insert the blanc pages like:
Code: ... import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.PdfStamper; ...
public void addBlancPagesToPDFforDuplexPrinting() {
final int pnEveryEachPage = 3;
try {
//PdfReader reader = new PdfReader("YourOwnPDF.pdf");
logger.info("addBlancPagesToPDFforDuplexPrinting");
File outFile = getOutFile();
String newFileName = getOutFile() + ".original";
File newFile = new File(newFileName);
outFile.renameTo(newFile);
PdfReader reader = new PdfReader(newFileName);
PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(getOutFile()));
int customers = reader.getNumberOfPages() / pnEveryEachPage;
Rectangle rctnl = reader.getPageSizeWithRotation(1);
/* if there are 4 customers, you have 12 pages
insert blanc page first at the least customer */
for (int i = customers; i > 0; i--) {
stamp.insertPage(pnEveryEachPage * i + 1, rctnl);
}
stamp.close();
reader.close();
} catch (Exception e) {
logger.log(Level.WARNING, "Error adding blanc pages : {0}", e.getCause());
}
}
.
|
|
guest |