Comments (4)
@jberkenbilt should I somehow be closing the input QPDF after reading it here?
Lines 80 to 95 in a9aad79
fwiw we still bundle qpdf 8.4.0 right now (to support centos-7 systems).
from qpdf.
What you'll have to do is to use ClosedFileInputSource and processInputSource. See https://github.com/qpdf/qpdf/blob/989819b75fba380ecdc7416a504ed4b3a2d42ccb/libqpdf/QPDFJob.cc#L2590 as an example, and let me know if you need more guidance. The idea is that ClosedFileInputSource is an input source that opens the file when it needs to use it and closes it afterwards. It causes some overhead, but on a local file system, it's negligible. The overhead is very high over a network file system. ClosedFileInputSource has a stayOpen method you can use as a hint to keep it open if you're going to be doing a lot of operations. The code in QPDFJob that combines pages keeps it open while adding pages, but ultimately it's QPDFWriter that will pull the data out of the original files, and it will open the files multiple times, which shouldn't be an issue. While QPDFJob is later than 8.4.0, all the basic methods called in this example are there in 8.4.0, though you will still need PointerHolder instead of std::shard_ptr. You can probably find this same block of code in qpdf/qpdf.cc in 8.4.0.
from qpdf.
I tried to have a look at this ClosedFileInputSource api but I can't figure it out. I think we'll have to table it anyway until we upgrade the bundled libqpdf.
I wish there was just a simple way to close the files from a QPDF
object once we are done with it.
from qpdf.
You could use ClosedFileInputSource
for this. You can find several examples in QPDFJob.cc. But, yeah, 8.4.0 is really old.
from qpdf.
Related Issues (15)
- Feature Request
- Question: overlaying OCR'd text in package scope?
- Feature Request: pdf_split() function appending too many zeros into file name. HOT 2
- Feature Request: Integration of Pages from Multiple PDFs HOT 1
- Can you add parameters to make the page size uniform using pdf_combine()
- jpeglib.h not found HOT 3
- Bookmarks
- Expose overlay feature HOT 4
- Error: ld: library not found for -ljpeg HOT 13
- WARNING qpdf is needed for checks on size reduction of PDFs
- pdf_split creates file names with excessive length HOT 10
- Error when installing qpdf in Windows 10
- Compatibility with qpdf 11 HOT 4
- Remove PDF pages while retaining the bookmarks HOT 2
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 qpdf.