Replies: 1 comment
-
here is a (js) solution, could be more streamlined, but it works !!! function createPagePatternAnnotation(page) { const ops = [ const pdfDoc = await PDFDocument.create() const pattern_ref = createPagePatternAnnotation(page) // Add the pattern to the page's resources page.pushOperators( const pdfBytes = await pdfDoc.save({useObjectStreams: false, dataUri: false}) fs.writeFileSync('main_fill_pattern.pdf', pdfBytes) BTW: is there a possibility to disable Filter FlateDeflate for streams (with paths). quite difficult to debug |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
is it possible to implement a pattern object which could be used for filling of a shape, like in this short demo pdf
`
%PDF-1.3
%ÿÿÿÿ
1 0 obj
<< /Creator
/Producer
endobj
2 0 obj
<< /Type /Catalog
/Pages 3 0 R
endobj
3 0 obj
<< /Type /Pages
/Count 1
/Kids [5 0 R]
endobj
4 0 obj
<< /Length 64
stream
q
/Pattern cs
/SPdummytest123 scn
50.0 200.0 100.0 100.0 re
f
Q
endstream
endobj
5 0 obj
<< /Type /Page
/Parent 3 0 R
/MediaBox [0 0 595.28 841.89]
/CropBox [0 0 595.28 841.89]
/BleedBox [0 0 595.28 841.89]
/TrimBox [0 0 595.28 841.89]
/ArtBox [0 0 595.28 841.89]
/Contents 4 0 R
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/Pattern << /SPdummytest123 6 0 R
endobj
6 0 obj
<< /PatternType 1
/PaintType 1
/TilingType 2
/BBox [0 0 20 20]
/XStep 20
/YStep 20
/Matrix [1 0 0 1 0 0]
/Length 22
stream
5.0 5.0 10.0 10.0 re
f
endstream
endobj
xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000109 00000 n
0000000158 00000 n
0000000215 00000 n
0000000329 00000 n
0000000638 00000 n
trailer
<< /Size 7
/Root 2 0 R
/Info 1 0 R
startxref
812
%%EOF
`
could
page.node.newXObject page.node.setXObject
be used to generate the 6 0 obj (which contains the pattern)???
aha
Beta Was this translation helpful? Give feedback.
All reactions