Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the PDF-API2 CPAN distribution.

Report information
The Basics
Id: 92045
Status: rejected
Priority: 0/
Queue: PDF-API2

Owner: Nobody in particular
Requestors: jcwren [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: PDF::API2::Basic::PDF::File->copy() fails to copy properly
Date: Fri, 10 Jan 2014 21:40:07 -0500
To: bug-PDF-API2 [...]
From: "J.C. Wren" <jcwren [...]>
Download (untitled) / with headers
text/plain 1.4k
PDF::API2 is version 2.020. Using the following program, I would expect that "test_in.pdf" should be copied to "test_out.pdf", and that "test_out.pdf" would be a usable file. use strict; use warnings; use PDF::API2; my $out = PDF::API2::Basic::PDF::File->new; my $pdf = PDF::API2::Basic::PDF::File->open ("test_in.pdf"); $pdf->copy ($out); $out->{' version'} = 4; $out->out_file ("test_out.pdf"); However, Adobe Reader on multiple platforms will not open the file (error 14), and pdfinfo (from poppler) reports the following: jcw$ pdfinfo test_in.pdf Title: Competitors in CGC Jan 11th Subject: Shoot'n Score It Keywords: Shoot'n Score It, Author: JC Wren Creator: Shoot'n Score It Producer: ReportLab PDF Library - CreationDate: Fri Jan 10 10:34:03 2014 Tagged: no Form: none Pages: 3 Encrypted: no Page size: 595.276 x 841.89 pts (A4) Page rot: 0 File size: 8502 bytes Optimized: no PDF version: 1.4 jcw$ pdfinfo test_out.pdf Syntax Error: Top-level pages object is wrong type (null) Syntax Error: Top-level pages object is wrong type (null) Command Line Error: Wrong page range given: the first page (1) can not be after the last page (0). I'm no expert on PDF file formats, and spending a few minutes staring at it didn't yield any useful clues. --jc Save a life; adopt a shelter animal.
Download test_in.pdf
application/pdf 8.3k

Message body not shown because it is not plain text.

Download test_out.pdf
application/pdf 7.3k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 668b
A couple of things: 1) The PDF::API2::Basic namespace is intended for internal use by PDF::API2 -- any other use is unsupported (though if you find a bug and have a patch to fix it, I'll definitely look at it). Try starting from PDF::API2 instead. 2) The test case is probably too contrived for me to understand what you're trying to do. It looks like "cp source.pdf target.pdf" would be much simpler based on the information you've given. PDF::API2 is not especially good at manipulating PDF files -- it's mainly intended for creating them, sometimes based on existing files in limited circumstances. Patches to improve how it manipulates PDF files are welcome.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to