Comments (2)
Not the way the function cpp_pdf_split
used by qpdf::pdf_subset
is written. cpp_pdf_split
copies the pages requested to a new empty pdf file, which looses all bookmarks, links, etc. To preserve bookmarks, cpp_pdf_split
would need to remove any pages not requested from the input file. This would be a relatively trivial to implement.
from qpdf.
Sample implementation:
Rcpp::CharacterVector cpp_pdf_select(char const* infile, char const* outfile,
Rcpp::IntegerVector which, char const* password){
QPDF inpdf;
read_pdf_with_password(infile, password, &inpdf);
QPDFPageDocumentHelper in_pdh(inpdf);
std::vector<QPDFPageObjectHelper> pages = in_pdh.getAllPages();
for (auto const& page :pages) {
in_pdh.removePage(page);
}
for (int i = 0; i < which.size(); i++) {
int index = which.at(i) -1; //zero index
in_pdh.addPage(pages.at(index), false);
}
QPDFWriter outpdfw(inpdf, outfile);
outpdfw.setStaticID(true); // for testing only
outpdfw.setStreamDataMode(qpdf_s_preserve);
outpdfw.write();
return outfile;
}
from qpdf.
Related Issues (15)
- Feature Request
- 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
- Question: overlaying OCR'd text in package scope?
- Compatibility with qpdf 11 HOT 4
- Error: too many open files HOT 4
- 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
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.