Comments (3)
This PDF has image resources, rather than inline images. If every page has an image resource named FFX1
, then to get at the raw image data:
use PDF::API6;
use PDF::XObject::Image;
my PDF::API6 $pdf .= open: "test.pdf";
my $n := $pdf.page-count;
my PDF::XObject::Image @images = (1 .. $n).map: -> $page-num {
$pdf.page($page-num)<Resources><XObject><FXX1>;
}
with @images.head -> $img {
my blob8 $raw-compressed = $img.encoded.encode('latin-1');
my blob8 $raw-uncompressed = $img.decoded;
# partially implemented. probably returns Nil
note (try $img.to-png1).WHAT.raku;
}
However, a PDF may contain several image formats, and the to-png
is only partially implemented for some image formats. It will most likely return Nil rather than an object of PDF::Content::Image::PNG
. It could be that image magick, or other image manipulation libraries can load the raw compressed or uncompressed data.
Reading of images from PDF files could, in general, do with a lot more work. I'd been thing of trying to integrate MagicWand, or something similar, but would need to investigate further.
from pdf-api6.
Thank you! I expected the format to be anything but hoped that perhaps PDF::To::Cairo can manage it. But with the current state of affairs it looks like using something like pdftoppm
would be preferable.
BTW, unrelated. A while ago I desperately wanted to intercept PDF rendering to pull out data from it. No idea how I managed to overlook PDF::API6 being capable of this, but at the moment I'm biting own elbows seeing the possibilities I would have!
from pdf-api6.
pdftoppm
Sound reasonable.
Yeah PDF::To::Cairo is just an advanced application of rendering also available in PDF::API6. PDF::Tags::Reader is another example that renders to extract structure and text from a tagged PDF file.
from pdf-api6.
Related Issues (16)
- Rebase from PDF::Lite to PDF::Zen HOT 2
- README needs reorganization/transference to doco repository HOT 9
- Support named destinations HOT 2
- todo: Digital Signing
- Unable to use text methods on multiple pages HOT 1
- Using @bbox = .print: $text, :align<center> results in incorrect @bbox coords HOT 3
- Valign not centering text in xforms HOT 2
- Implement Outlines. HOT 1
- Error while trying to write on a PDF v.1.6 HOT 8
- Actions annotation and field construction. HOT 2
- Click the outlines after make toc, but it doesn't jump to the special page number HOT 4
- [thanks] This looks very useful for my tax needs HOT 9
- Todo: Support Form-filling HOT 1
- Adding an image doesn't seem to work HOT 6
- Explain what the "codes" are in the various tables in file README.md HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf-api6.