(received via email from OP)
Hi,
Sorry to contact you directly instead of through this page
https://rt.cpan.org/Public/Bug/Display.html?id=130805
But, I couldn't figure out how to post a reply there.
==================================================
To add a comment to this thread, just email bug-PDF-API2 [at] rt.cpan.org with subject line [rt.cpan.org #130805]. Note 1 space between org and #, and the [ ] around the whole subject. Nothing else. If you don't follow this format carefully, you will end up creating a new bug report! HTML formatting within the body does not work.
==================================================
-------------------------------------------------------------
Comments inserted below ....
Well, yes, we ARE going to need an example PDF that shows this problem. If I understand your explanation, you have a working PDF, modify it with GS, and then Adobe doesn't like it?
- Have an existing .pdf (v1.4). Added "Hello World" to the
pdf via PDF::API2, then saved. Then tried to make a copy in
GS, GS fails to make a copy.
=================================================================
use PDF::API2 ();
$input_file = '66.pdf';
$output_file = '67.pdf';
system "/usr/bin/gs", "-sDEVICE=pdfwrite", "-o", "${output_file}GS", "$input_file";
print "------------------------------------------------------\n";
my $pdf = PDF::API2->new();
my $template_pdf = PDF::API2->open($input_file);
$pdf->import_page($template_pdf, 1);
$page = $pdf->openpage(1);
$font = $pdf->corefont('Helvetica-Bold');
$text = $page->text();
$text->font($font, 20);
$text->translate(200, 700);
$text->text('Hello World!');
$pdf->saveas($output_file);
system "/usr/bin/gs", "-sDEVICE=pdfwrite", "-o", "${output_file}GS", "$output_file";
====================================================================
GPL Ghostscript 9.25 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
**** Error reading a content stream. The page may be incomplete.
Output may be incorrect.
**** Error: Form stream has unbalanced q/Q operators (too many q's)
Output may be incorrect.
**** Error reading a content stream. The page may be incomplete.
Output may be incorrect.
Loading NimbusSans-Bold font from /usr/share/ghostscript/Resource/Font/NimbusSans-Bold... 5460108 4049994 3001452 1570283 3 done.
**** Error: File did not complete the page properly and may be damaged.
Output may be incorrect.
========================================================================
Was this PDF originally produced with PDF::API2?
- Don't know, it was provided by a client and is a few years old
Which "Adobe" are you talking about -- Reader, Acrobat, or something else?
- File can't be read via Explorer/Firefox either, so it's the
browser plugin (Acrobat Reader DC?). Ok in Chrome.
First of all, PDF::API2 produces PDF 1.4, which while old, should work OK with GS or Adobe. If GS takes a working PDF (that Reader doesn't ask to SAVE after displaying), and breaks it, that sounds like a problem with GS. Without seeing an example, though, it's hard to say for sure whether there was something odd about the original PDF.