IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

every 4th page different footer Options · View
Bry
Posted: Monday, June 3, 2019 1:23:58 PM
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.


K101
Posted: Tuesday, June 4, 2019 8:43:11 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
It may be possible to do what you want using document sections and first/last/even/odd footers.
Bry
Posted: Wednesday, June 5, 2019 1:28:22 PM
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.
Yours

File Attachment(s):
message_demo.zip (3kb) downloaded 77 time(s).


K101
Posted: Thursday, June 6, 2019 10:28:13 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
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 83 time(s).


Bry
Posted: Friday, June 7, 2019 9:30:18 AM
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)
K101
Posted: Friday, June 7, 2019 2:21:35 PM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
Then just put your footers on the secondary document section instead of the Initial Document Section.
Bry
Posted: Wednesday, June 19, 2019 11:43:18 AM
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?
K101
Posted: Friday, June 21, 2019 10:35:39 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
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.
Bry
Posted: Friday, June 28, 2019 10:07:46 AM
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.
K101
Posted: Friday, June 28, 2019 12:34:02 PM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
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.
Bry
Posted: Wednesday, July 3, 2019 1:25:12 PM
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.

K101
Posted: Thursday, July 4, 2019 10:58:27 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
Maybe post-process the PDF, then? Perhaps there's some command-line tool you can use to delete the first page of a PDF.
Bry
Posted: Monday, July 8, 2019 3:08:02 PM
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());

   }

}
.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.