pdf

PDFBOX 2.0.18 - How to iterates through pages of a PDF and retrieve specific fields

无人久伴 提交于 2021-01-28 14:40:21
问题 I'm using PDFBox to read specific fields on a pdf document. Actually, I'm able to get all the informations I want with a pdf containing only one page. The PDF has fields with specific names and I can get all the fields and insert it in a database. I use this code with AccroForm to access the fields InputStream document = item.getInputStream(); pdf = PDDocument.load(new RandomAccessBufferedFileInputStream(document)); pdCatalog = pdf.getDocumentCatalog(); pdAcroForm = pdCatalog.getAcroForm();

How to export an xtable as PDF directly via R script?

扶醉桌前 提交于 2021-01-28 13:55:08
问题 I have a data.frame that I need as a nice PDF table for a scientific poster. While it's very easy to export plots via pdf() , I'm stuck with this table. I know how to get a PDF table with rmarkdown, e.g. --- output: pdf_document --- ```{r tab, echo=FALSE, results='asis'} library(xtable) xtable(head(mtcars)) ``` But I want this output directly from the R script, e.g. renderThisToPDF(xtable(head(mtcars), to="nicetable.pdf") # fantasy code How would I do this? So far I attempted this code with a

acrobat reduced size pdf with gs/im/other?

我只是一个虾纸丫 提交于 2021-01-28 13:40:10
问题 In Acrobat 11 Pro, I can do File > Save As Other > Reduced Size PDF (setting as Acrobat 10 viewer or later), which cut a PDF to about 40% and looks exactly the same. I am wondering how I can achieve the same result with an open source tool like ghost script, image magick, or some adobe tools on a linux server via CL or PHP. 回答1: gswin64c -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf This works pretty well to reduce

Send pdf via express to js client and download

 ̄綄美尐妖づ 提交于 2021-01-28 12:20:12
问题 I am trying to send pdf file from my express server using the client when requested like this: res.setHeader('Content-Type', 'application/pdf'); res.setHeader('Content-Disposition', 'attachment; filename=test.pdf'); fs.createReadStream('test.pdf').pipe(res); And then on the client side I am trying to download it by taking the resulting string converting it to a url and downloading from there. var blob = new Blob[pdfString], { type: 'application/pdf' }); var url = window.URL; var downloadUrl =

Memory full error when exporting crystal report to pdf

天大地大妈咪最大 提交于 2021-01-28 12:14:56
问题 we have a legacy application written in visual basic 6.0. This application first saves the rendered crystal report into a directory as a pdf document. Then we take that document and store in database as a blob. Following is a snippet of the code. When the application has to render reports for say 1000 employees, it runs half-way through and throws "Memory full" error on ".Export false" line. If I hit play button after it throws the exception, it works fine. But, someone has to watch for it

incorrect encoding serving binary (pdf) file through ClassPathResource in Spring

旧城冷巷雨未停 提交于 2021-01-28 11:23:06
问题 I have been struggling with the following problem for two days and can not get my head around it. I am trying to serve a static pdf in a Spring Boot rest application. It should be very straight forward but I just cannot get it to work. First I simply placed the pdf in the resource folder and tried to load it directly from the javascript code, like this: var newWindow = window.open(/pdf/test.pdf, ''); That resulted in a new window with a pdf not showing any content. Saving the pdf to disk from

How do I know my file is attached in my PDF using PyPDF2?

给你一囗甜甜゛ 提交于 2021-01-28 11:10:57
问题 I am trying to attach an .exe file into a PDF using PyPDF2. I ran the code. It runs flawlessly, but my PDF file is still the same size. I don't know if my file was attached or not. This is what I am trying to do: from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() input1 = PdfFileReader(open ("doc1.pdf", "rb")) #check it's whether work or not print("doc1 has %d pages" % input1.getNumPages()) output.addAttachment("doc1.pdf","client.exe") I don't know if I am doing this

How do I know my file is attached in my PDF using PyPDF2?

Deadly 提交于 2021-01-28 11:04:52
问题 I am trying to attach an .exe file into a PDF using PyPDF2. I ran the code. It runs flawlessly, but my PDF file is still the same size. I don't know if my file was attached or not. This is what I am trying to do: from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() input1 = PdfFileReader(open ("doc1.pdf", "rb")) #check it's whether work or not print("doc1 has %d pages" % input1.getNumPages()) output.addAttachment("doc1.pdf","client.exe") I don't know if I am doing this

React and PDF.js changing page doesn't work when I render whole document

前提是你 提交于 2021-01-28 09:50:42
问题 I'm trying to render PDF file in my web application in React using PDF.js library. There is so much different information out there, even in the official git, so I'm stuck with trying to render the whole pdf document and also have the function to go to particular page. This is what I have for now: import * as pdfWorker from 'pdfjs-dist/build/pdf.worker' import PdfJsLib from 'pdfjs-dist'; import 'pdfjs-dist/web/pdf_viewer.css'; import * as pdfjsViewer from 'pdfjs-dist/web/pdf_viewer'; ...

React and PDF.js changing page doesn't work when I render whole document

依然范特西╮ 提交于 2021-01-28 09:32:59
问题 I'm trying to render PDF file in my web application in React using PDF.js library. There is so much different information out there, even in the official git, so I'm stuck with trying to render the whole pdf document and also have the function to go to particular page. This is what I have for now: import * as pdfWorker from 'pdfjs-dist/build/pdf.worker' import PdfJsLib from 'pdfjs-dist'; import 'pdfjs-dist/web/pdf_viewer.css'; import * as pdfjsViewer from 'pdfjs-dist/web/pdf_viewer'; ...