Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 953279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:01:44+00:00 2026-05-16T00:01:44+00:00

I have a PDF with A4 pages. Each page contains two identical A5 pages

  • 0

I have a PDF with A4 pages. Each page contains two identical A5 pages for printing reasons. What I want to do in my Java program is to split these pages and use each unique A5 page zero to many times as a template to add/replace some text. After this is done I want to glue the A5 pages back again to A4 pages (for the same printing reasons).

An example: Use page one three times and page two one time.

  • Split the pages. (And throw away the identical right A5 pages)
  • Create three copies of the first page and one copy of the second page.
  • Add/replace the text.
  • Glue the pages together so that I get two A4 pages. The first one with the first two “page ones” and the second one with the third “page one” and the only “page two”.

This should be possible? Shouldn’t it?
I’m thinking of using iText. But if anyone has any other recommendation I’m happy to change my mind about that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:01:44+00:00Added an answer on May 16, 2026 at 12:01 am

    I once did something like that with camlpdf. In my case, I had a PDF where a physical A4 page consisted of two logical A5 pages and I wanted to get a normal PDF with A5 pages (i.e. where logical and physical page were the same).

    This was in OCaml (camlpdf also exists for F#) and my code was the following:

    let pdf = Pdfread.pdf_of_file None in_file ;;
    
    let pdf =
      let (pdf,_perms) = Pdfcrypt.decrypt_pdf "" pdf in
      match pdf with
      | Some pdf -> pdf
      | None -> failwith "Could not decrypt"
    ;;
    
    let pdf = Pdfmarks.remove_bookmarks pdf ;;
    
    let pages = Pdfdoc.pages_of_pagetree pdf ;;
    
    let pages = List.fold_right (fun page acc ->
      let (y1,x1,y2,x2) = Pdf.parse_rectangle page.Pdfdoc.mediabox in
      let box y1 x1 y2 x2 = Pdf.Array
        [ Pdf.Real y1; Pdf.Real x1; Pdf.Real y2; Pdf.Real x2 ]
      in
      let xm = x1 *. 0.5 +. x2 *. 0.5 in
      let pagel = {page with Pdfdoc.mediabox = box y1 x1 y2 xm}
      and pager = {page with Pdfdoc.mediabox = box y1 xm y2 x2}
      in pagel::pager::acc
    ) pages [] ;;
    
    let pdf = Pdfdoc.change_pages false pdf pages ;;
    
    Pdf.remove_unreferenced pdf ;;
    
    Pdfwrite.pdf_to_file pdf out_file ;;
    

    If iText offers similar abstractions, perhaps you can do something like this. The procedure is the following:

    1. Read and (optionally) decrypt the pdf
    2. Remove bookmarks (optional)
    3. Obtain the pages from the page tree
    4. Manipulate the pages: you can rearrange, duplicate and remove pages, and you can change their mediabox (bounding box); that should be enough for your purpose?
    5. Reconstruct the document with the new pages
    6. Remove unreferenced objects (like a garbage collect)
    7. Write out the resulting PDF
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have pdf document, for example 25 pages. How to add one blank page
I have a UIPageViewController with several pages. Each page is the same view controller,
I have 3 ASPX pages. A usercontrol on each page has an email placeholder
I have subclassed UIView object inside a uiscrollview which displays a pdf page. I
I have a very large Excel sheet converted from a 6000 page PDF file,
i have a page like: and i need to print to pdf ( or
I have ASP.NET page with an iframe on it for displaying some pdf reports
in my application, I have pdf files. I want to save those pdf files
I have some PDF files in a public rails folder. I want to set
I have a link on a page which generates a pdf. I am using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.