Closed frithnanth closed 6 years ago
Hi @frithnanth
Update: zef uninstall
not zef nuke
I think there's some conflict between old and new versions. Does it help to do a reinstall of the PDF tool-chain as follows (allow ~ 30 mins):
% zef nuke PDF::API6 PDF::Class PDF::Content PDF PDF::Grammar
% zef uninstall PDF::API6 PDF::Class PDF::Content PDF PDF::Grammar
% zef install PDF::API6
After that, I'd also also recommend deleting any local .precomp directories
Hope this helps.
Hi @dwarring
I uninstalled and reinstalled the modules:
$ zef install PDF::API6
===> Searching for: PDF::API6
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan.json
===> Updated p6c mirror: http://ecosystem-api.p6c.org/projects.json
===> Searching for missing dependencies: PDF, PDF::Class, PDF::Content
===> Searching for missing dependencies: PDF::Grammar
===> Testing: PDF::Grammar:ver<0.1.5>:auth<github:p6-pdf>:api<PDF-1.7>
# loading t/helloworld.pdf (set $TEST_PDF to override)
===> Testing [OK] for PDF::Grammar:ver<0.1.5>:auth<github:p6-pdf>:api<PDF-1.7>
===> Testing: PDF:ver<0.2.8>:auth<github:p6-pdf>:api<PDF-1.7>
===> Testing [OK] for PDF:ver<0.2.8>:auth<github:p6-pdf>:api<PDF-1.7>
===> Testing: PDF::Content:ver<0.2.1>:auth<github:p6-pdf>:api<PDF-1.7>
error processing 'RG' (SetStrokeRGB) operator
error processing 'TL' (SetTextLeading) operator
error processing 'Tf' (SetFont) operator
===> Testing [OK] for PDF::Content:ver<0.2.1>:auth<github:p6-pdf>:api<PDF-1.7>
===> Testing: PDF::Class:ver<0.1.2>:auth<github:p6-pdf>:api<PDF-1.7>
eval error: use PDF::Class;
use PDF::Catalog;
my PDF::Class $pdf .= new;
my PDF::Catalog $doc = $pdf.catalog;
try {
$doc.PageMode = 'UseToes';
CATCH { default { say "err, that didn't work: $_" } }
}
# same again, bypassing type checking
$doc<PageMode> = :name<UseToes>;
in block at t/00-readme.t line 25
unknown /ShadingType 42 - supported range is 1..7
No Doc handler class [PDF PDF::COS::Type]::Unknown
No Doc handler class [PDF PDF::COS::Type]::Annot::Caret
===> Testing [OK] for PDF::Class:ver<0.1.2>:auth<github:p6-pdf>:api<PDF-1.7>
===> Testing: PDF::API6:ver<0.1.0>:auth<github:p6-pdf>
("q", "BT", "/F1 16 Tf", "1 0 0 1 10 10 Tm", "(Hello, world) Tj", "17.6 TL", "T*", "ET", "q", "19 0 0 19 110.688 10 cm", "/Im1 Do", "Q", "Q").Seq
Text matrix updated by Tm to 1 0 0 1 10 10
===> Testing [OK] for PDF::API6:ver<0.1.0>:auth<github:p6-pdf>
===> Installing: PDF::Grammar:ver<0.1.5>:auth<github:p6-pdf>:api<PDF-1.7>
===> Installing: PDF:ver<0.2.8>:auth<github:p6-pdf>:api<PDF-1.7>
===> Installing: PDF::Content:ver<0.2.1>:auth<github:p6-pdf>:api<PDF-1.7>
===> Installing: PDF::Class:ver<0.1.2>:auth<github:p6-pdf>:api<PDF-1.7>
===> Installing: PDF::API6:ver<0.1.0>:auth<github:p6-pdf>
6 bin/ scripts [pdf-rewriter.pl pdf-append.p6 pdf-checker.p6 pdf-info.p6 pdf-revert.p6 pdf-burst.p6] installed to:
/home/nando/.perl6/bin
There are some non-fatal errors, but the modules have been installed. Still, when I run this program:
use PDF::API6;
my PDF::API6 $pdf .= open('old.pdf');
my $page = $pdf.page(1);
my $font = $pdf.core-font('Helvetica-Bold');
$page.text: {
.font = $font, 20;
.text-position = 200, 700;
.say('Hello World!');
}
$pdf.save-as('new.pdf');
I get this error:
Cannot find method 'specialize' on object of type Perl6::Metamodel::ClassHOW+{<anon>}
in method mixin at /home/nando/.perl6/sources/822169956771DB33FC0D5BAD82085542A72639DE (PDF::COS::Tie) line 200
in method coerce at /home/nando/.perl6/sources/9E089E43DB4C2FF54174FCC674C74CD710DDD2AA (PDF::COS::Coercer) line 63
in method coerce at /home/nando/.perl6/sources/5091F292E9E62412B6143E4C6F25AA9CDE28AC2B (PDF::COS) line 28
in sub at /home/nando/.perl6/sources/822169956771DB33FC0D5BAD82085542A72639DE (PDF::COS::Tie) line 56
in block at /home/nando/.perl6/sources/822169956771DB33FC0D5BAD82085542A72639DE (PDF::COS::Tie) line 106
in method tie at /home/nando/.perl6/sources/822169956771DB33FC0D5BAD82085542A72639DE (PDF::COS::Tie) line 61
in method tie at /home/nando/.perl6/sources/822169956771DB33FC0D5BAD82085542A72639DE (PDF::COS::Tie) line 125
in method AT-KEY at /home/nando/.perl6/sources/B8B8813B96AB3C0DAEC7B650580E7B18F08E5E8B (PDF::COS::Tie::Hash) line 54
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 29
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method ref-count at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 22
in method body at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 67
in method ast at /home/nando/.perl6/sources/4F8D91227F7DC384FC722C468900C06197500BA9 (PDF::IO::Serializer) line 259
in method ast at /home/nando/.perl6/sources/AD3EF7527B03D7E88AE13AFFE91836B2747B9109 (PDF) line 127
in method save-as at /home/nando/.perl6/sources/AD3EF7527B03D7E88AE13AFFE91836B2747B9109 (PDF) line 149
in method save-as at /home/nando/.perl6/sources/3A0455208EBF84A2A5453574B6FDBDD294BDB416 (PDF::Class) line 61
in method save-as at /home/nando/.perl6/sources/AD3EF7527B03D7E88AE13AFFE91836B2747B9109 (PDF) line 144
in method save-as at /home/nando/.perl6/sources/3A0455208EBF84A2A5453574B6FDBDD294BDB416 (PDF::Class) line 61
in method save-as at /home/nando/.perl6/sources/AD3EF7527B03D7E88AE13AFFE91836B2747B9109 (PDF) line 130
in method save-as at /home/nando/.perl6/sources/3A0455208EBF84A2A5453574B6FDBDD294BDB416 (PDF::Class) line 61
in block <unit> at ./test.p6 line 13
I'm attaching the PDF file I'm using here. pdf4.pdf
Thank you!
Thanks @frithnanth. Will look at this over the next few days.
Able to replicate this error when I follow the same steps.
Error and failure point changes when I set the include path and add some debugging:
perl6 -I. -I ../PDF-Content-p6/ -I ../PDF-p6/ -I ../PDF-Grammar-p6/ -I ../PDF-Class-p6 /tmp/tst.pl
{:obj(${:Procset($["PDF", "Text"])}), :role(PDF::Resources)}
in method mixin at /home/david/git/PDF-API6/../PDF-p6/lib/PDF/COS/Tie.pm (PDF::COS::Tie) line 200
{:obj(${:ExtGState(${:GS0(:ind-ref($[18, 0])), :GS1(:ind-ref($[17, 0]))}), :Font(${:C2_0(:ind-ref($[5, 0])), :TT0(:ind-ref($[14, 0])), :TT1(:ind-ref($[11, 0]))}), :ProcSet($["PDF", "Text"])}), :role(PDF::Resources)}
in method mixin at /home/david/git/PDF-API6/../PDF-p6/lib/PDF/COS/Tie.pm (PDF::COS::Tie) line 200
{:obj(${}), :role(PDF::Resources)}
in method mixin at /home/david/git/PDF-API6/../PDF-p6/lib/PDF/COS/Tie.pm (PDF::COS::Tie) line 200
Probable version skew in pre-compiled '/home/david/git/PDF-API6/../PDF-Class-p6/lib/PDF/Font.pm (PDF::Font)' (cause: no object at index 778)
I can reproduce the error with a very simple test program:
use PDF::API6;
use PDF::Font::CIDFontType2;
==SORRY!=== Error while compiling /tmp/site#sources/58028D652811A12AAA9177AE3895DE5D47ADE0FD (PDF::Font::CIDFontType2) Probable version skew in pre-compiled 'site#sources/BFD03D5F53D8E5928328176228516E260AB2C81D (PDF::Font)' (cause: no object at index 723) at /tmp/site#sources/58028D652811A12AAA9177AE3895DE5D47ADE0FD (PDF::Font::CIDFontType2):5
Evidently, PDF files with CIDFontType2 fonts are currently failing.
Latest PDF 0.3.0 and PDF::Class 0.1.3 fixes the secondary error Cannot find method 'specialize' on object of type Perl6::Metamodel::ClassHOW
error. In a nutshell the PDF::COS coercements were being caused by attempts to mixin a class instead of a role, giving this error.
perl6 -e'class C1 {}; class C2 {}; my C1 $c .=new; $c.^mixin: C2'
Cannot find method 'specialize' on object of type Perl6::Metamodel::ClassHOW
in block <unit> at -e line 1
Still not entirely sure of the primary Probable version skew in pre-compiled
errors during upgrades. From past experience these may indicate that classes or roles are being mutated at run-time, e.g. by adding extra methods.
Thank you
Hopefully better now after changing the composition of some classes and additional fixes in the PDF module. Please try again when you get a chance.
Also fixed some (but not all) the the noisy tests in PDF::Content and PDF::Class
I see that PDF::Content still displays some errors:
error processing 'RG' (SetStrokeRGB) operator
error processing 'TL' (SetTextLeading) operator
error processing 'Tf' (SetFont) operator
but the installation proceeds anyway. Thank you!
Hello, I'm trying to upgrade this module, because I have an error message processing some PDF files using PDF::API6:
Probable version skew in pre-compiled
[...](PDF::Font)' (cause: no object at index 776)
But I'm getting this error during the testing phase:I have the following modules installed:
and perl6 version is: