Skip to main content
Participant
September 14, 2018
Answered

How do I change the page size on Mac without cropping now that Apple has removed the Acrobat PDF Printer?

  • September 14, 2018
  • 2 replies
  • 1696 views

The standard way to change the page size while maintaining the content (e.g., shrink to fit) is by printing to PDF using the new page size. But Apple has eliminated the Acrobat PDF printer.

I could crop. But this eliminates content.

Correct answer Dov Isaacs

“Printing to PDF” was never even a reasonable way to changing page size (even on Windows where one can still do that hackery). Why? Because such “refrying” of PDF is generally very lossy. You typically lose all color management, live transparency, and often text searchability and editability.

The proper way to handle page resizing is via Acrobat Pro's Preflight capability. Under the Prepress, Color, and Transparency profile group, choose the Scale pages to specified size single fixup:

Press Fix and that will yield the dialog:

Specify the size in millimeters for each of the short and long edges and press OK. Voila, pages resized.

Note 1:     You can make a copy of this fixup and edit the definition to use points or inches instead.

Note 2:     Note that this resizes all pages of a PDF file to the same new size. It does not allow specification of a page range. Thus, this would not work for a PDF with multiple page sizes for which you wish the resizing to be page size specific. However, you could make a copy of the fixup, writing a single check for a particular page size and use that as a condition for allowing the page scaling to occur for that particular page size.

          - Dov

2 replies

Participant
August 5, 2024

I am using transformation matrix for resize the page but if the page is having tables then content is missing. Is there any source code to handle this or printing pdf c++ source code using adobe APIs

S_S
Community Manager
Community Manager
January 13, 2025

Hi @Suresh38877043nre4,

 

Hope you are doing well. Thanks for writing in!

 

 

If you are still looking for a solution, below are my suggestions and comments on the workflow:

 

When resizing a page using a transformation matrix, objects like tables, images, or annotations might not scale or reposition correctly. This typically happens because:

  1. Objects are clipped outside the visible page boundary.
  2. The transformation matrix doesn’t account for content alignment or layout adjustments.

One solution could be to ensure all content fits within the adjusted page boundaries before applying the transformation:

  1. Retrieve the page’s CropBox, MediaBox, or ArtBox.
  2. Adjust these boxes to accommodate the scaled content.
  3. Reapply the transformation.

If this is not the solution, and you would like to go forward with the C++ codes using Adobe PDF Library, you can follow the below steps:

 

1. Initialize the APDFL environment.

  • Set up the library and open the document.

     

2. Apply Transformation Matrix:

  • Retrieve the page and its associated content.
  • Apply a scaling transformation matrix using PDPageSetMatrix or equivalent.

     

3. Adjust Page Boundaries:

  • Modify the CropBox, MediaBox, or other bounding boxes to ensure all content is visible.

4. Flatten Page Content:

  • Flatten the page to ensure annotations and other content are properly integrated into the page.

 

5. Save Changes:

  • Save the modified document.

 

 A sample code for the workflow:

#include "PDFL.h"
#include <iostream>

void resizePDFPage(const char* inputFile, const char* outputFile, double scaleFactor) {
    // Initialize APDFL
    APDFLib lib;
    if (!lib.isValid()) {
        std::cerr << "Failed to initialize APDFL." << std::endl;
        return;
    }

    // Open the document
    ASPathName pathName = ASFileSysCreatePathName(NULL, ASAtomFromString("Cstring"), inputFile, NULL);
    PDDoc pdDoc = PDDocOpen(pathName, NULL, NULL, true);
    if (!pdDoc) {
        std::cerr << "Failed to open PDF document." << std::endl;
        return;
    }

    // Get the first page (or loop through pages)
    PDPage pdPage = PDDocAcquirePage(pdDoc, 0);

    // Get page dimensions
    ASFixedRect mediaBox;
    PDPageGetMediaBox(pdPage, &mediaBox);

    // Calculate new dimensions
    double width = ASFixedToFloat(mediaBox.right - mediaBox.left) * scaleFactor;
    double height = ASFixedToFloat(mediaBox.top - mediaBox.bottom) * scaleFactor;

    // Set transformation matrix
    ASFixedMatrix matrix = {
        ASFloatToFixed(scaleFactor), 0, 0,
        ASFloatToFixed(scaleFactor), 0, 0
    };
    PDPageSetMatrix(pdPage, &matrix);

    // Adjust MediaBox to match new dimensions
    mediaBox.right = mediaBox.left + ASFloatToFixed(width);
    mediaBox.top = mediaBox.bottom + ASFloatToFixed(height);
    PDPageSetMediaBox(pdPage, &mediaBox);

    // Save the document
    PDDocSave(pdDoc, PDSaveFull, ASAtomFromString(outputFile), NULL, NULL, NULL);

    // Cleanup
    PDPageRelease(pdPage);
    PDDocClose(pdDoc);
    ASFileSysReleasePath(pathName);
}

int main() {
    const char* inputFile = "input.pdf";
    const char* outputFile = "output.pdf";
    double scaleFactor = 1.5; // Scale by 150%
    resizePDFPage(inputFile, outputFile, scaleFactor);
    return 0;
}

 

Note: I am not an expert on codes, and this may or may not work. This is just a trial I did on my end.

 

Hope this helps.


-Souvik

Dov Isaacs
Dov IsaacsCorrect answer
Legend
September 14, 2018

“Printing to PDF” was never even a reasonable way to changing page size (even on Windows where one can still do that hackery). Why? Because such “refrying” of PDF is generally very lossy. You typically lose all color management, live transparency, and often text searchability and editability.

The proper way to handle page resizing is via Acrobat Pro's Preflight capability. Under the Prepress, Color, and Transparency profile group, choose the Scale pages to specified size single fixup:

Press Fix and that will yield the dialog:

Specify the size in millimeters for each of the short and long edges and press OK. Voila, pages resized.

Note 1:     You can make a copy of this fixup and edit the definition to use points or inches instead.

Note 2:     Note that this resizes all pages of a PDF file to the same new size. It does not allow specification of a page range. Thus, this would not work for a PDF with multiple page sizes for which you wish the resizing to be page size specific. However, you could make a copy of the fixup, writing a single check for a particular page size and use that as a condition for allowing the page scaling to occur for that particular page size.

          - Dov

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)
Participating Frequently
February 19, 2025

Hello! Thank you for your answer, but "scale pages to specified size" does not appear as an option for me. Thoughts? I am on mac apple m3 pro with sequoia 15.3.1. and i have the latest acrobat pro version 2024.005.20400.

Bernd Alheit
Community Expert
Community Expert
February 19, 2025

At the top select a other library.