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 376493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:36:16+00:00 2026-05-12T14:36:16+00:00

Given a PDF, how can one get the layout mode of a PDF (or

  • 0

Given a PDF, how can one get the layout mode of a PDF (or relative width/height) using a PHP lib or linux command line tool?

Using http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf which can set this variable on new PDFs, but for existing pdfs from adobe.

Thought of converting pdfs to ps, or using gs in some other way – like converting it to an image first, and getting the width and height of that. Is this the best way?

  • 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-12T14:36:16+00:00Added an answer on May 12, 2026 at 2:36 pm

    The solution I’m using is to use ghostscript to print the first page to an image, then getting the image dimensions

    $cmd = 'gs -dSAFER -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sDEVICE=png16m -r400 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile="'.$complete_file_path.'/p%d.png" "'.$complete_file_path.'/'.$this->pdffilename.'"';
            $result = $this->proc( $cmd );
            list($width, $height, $type, $attr) = getimagesize($complete_file_path.'/'.$pngfilename);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a pdf generator for Rails 3.1 application.Which one can you suggest. I've
I can load list of pdf files(all pdf files) from Resources folder, using this
If I convert the given html to pdf with wkhtmltopdf the chart data will
Sometimes pdf might have a transparent background. And In my application I have given
Given a package, how can I automatically find all its sub-packages?
I have to upload a pdf file with 34MB. My site is in Linux
In my site the user can upload two kind of files: documents (doc, pdf,
I have a program that is manually generating a PDF using PDFsharp in C#.
I've got a project where I'm using a PDF generator to send a file
I am trying to Fill in a PDF from PHP script. I am following

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.