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

  • Home
  • SEARCH
  • 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 4001138
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:52:05+00:00 2026-05-20T07:52:05+00:00

Possible Duplicate: Split A4 PDF page into two A5 and back again I have

  • 0

Possible Duplicate:
Split A4 PDF page into two A5 and back again

I have A4 pages in a PDF file like the following:

this pdf

How could I split each A4 pages to two A5 pages?

  • 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-20T07:52:05+00:00Added an answer on May 20, 2026 at 7:52 am

    If this function is not already performed by some existing PDF tool, then here is a high-level brainstorm of how I would approach the problem with CAM::PDF. I’m not sure if it would work.

    • duplicate the page
    • rotate the content
    • set the crop box for each of the pages to just the half of interest

    Off the top of my head I don’t know if the extra out-of-cropbox content would be invisible, or if it would affect the render…

    UPDATE: I implemented a mostly-working, simplistic solution, as follows. It duplicates the page in question, rotates both copies, and sets the CropBox on each, choosing the left half for the first page and the right half of the second page. You may not need the rotation in your case, not sure.

    #!/usr/bin/perl
    use strict;
    use warnings;
    use CAM::PDF;
    my $pdffile = 't/sample1.pdf';
    my $pdfout = 'temp2.pdf';
    my $pagenum = 1;
    
    my $pdf = CAM::PDF->new($pdffile) or die $CAM::PDF::errstr;
    
    my ($objnum, $gennum) = $pdf->getPageObjnum($pagenum);
    my $pagedict = $pdf->getPage($pagenum);
    $pagedict->{Rotate} = CAM::PDF::Node->new('number', 90);
    my $oldbox = $pdf->getValue($pagedict->{CropBox} || $pagedict->{MediaBox});
    my @box = map {$pdf->getValue($_)} @{$oldbox};
    $pagedict->{CropBox} = CAM::PDF::Node->new('array', [
       map {CAM::PDF::Node->new('number', $_)} $box[0], $box[1], $box[2], ($box[3]+$box[1])/2
    ]);
    
    my $duplicate = CAM::PDF->new($pdffile) or die $CAM::PDF::errstr;
    $duplicate->extractPages($pagenum);
    $pdf->appendPDF($duplicate); # appends at end instead of inserting                                                                                                  
    
    $pagedict = $pdf->getPage($pdf->numPages());
    $pagedict->{Rotate} = CAM::PDF::Node->new('number', 90);
    $pagedict->{CropBox} = CAM::PDF::Node->new('array', [
       map {CAM::PDF::Node->new('number', $_)} $box[0], ($box[3]+$box[1])/2, $box[2], $box[3]
    ]);
    
    if ($objnum) {
       $pdf->{changes}->{$objnum} = 1;
    }
    $pdf->cleanoutput($pdfout);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP - How to split a paragraph into sentences. I have a
Possible Duplicate: How can I split an IEnumerable<String> into groups of IEnumerable<string> I have
Possible Duplicate: Split string in SQL I have seen a couple of questions related
Possible Duplicate: Why split the <script> tag when writing it with document.write()? I have
Possible Duplicate: How do you split a list into evenly sized chunks in Python?
Possible Duplicate: Best practice: Import mySQL file in PHP; split queries How to import
Possible Duplicate: How do you split a list into evenly sized chunks in Python?
Possible Duplicate: Split a number into its digits with Haskell how can i convert
Possible Duplicate: Split string to equal length substrings in Java Given the following utility
Possible Duplicate: Split string, convert ToList<int>() in one line… i have a string that

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.