Questions tagged [pdf-manipulation]

53 questions
79
votes
5 answers

Documentation for using JavaScript code inside a PDF file

Where can I find documentation on running JavaScript code inside a PDF? I've never added a JavaScript action inside a PDF document. However, I've done quite a bit of web development using JavaScript. I have a few questions to whoever has any…
Sam
  • 25,752
  • 12
  • 68
  • 97
24
votes
8 answers

How to convert a PDF to grayscale from command line avoiding to be rasterized?

I'm trying to convert to grayscale this PDF: https://dl.dropboxusercontent.com/u/10351891/page-27.pdf Ghostscript (v 9.10) with pdfwrite Device fails with a "Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged."…
Panda
  • 265
  • 1
  • 2
  • 7
14
votes
1 answer

Manipulating fillable PDFs in Elixir/Erlang

I've been trying to find example functionality in Elixir or Erlang for taking a fillable PDF and then filling it with input data from an application. So far I haven't been able to find any solutions to this in either Elixir or Erlang. Does anyone…
Jack Carlisle
  • 1,005
  • 1
  • 9
  • 14
14
votes
5 answers

Parsing a PDF with no /Root object using PDFMiner

I'm trying to extract text from a large number of PDFs using PDFMiner python bindings. The module I wrote works for many PDFs, but I get this somewhat cryptic error for a subset of PDFs: ipython stack…
Louis Thibault
  • 16,122
  • 21
  • 72
  • 136
6
votes
4 answers

Change metadata of pdf file with pypdf2

I want to add a metadata key-value pair to the metadata of a pdf file. I found a several years old answer, but I think this is way to complicated. I guess there is an easier way today: https://stackoverflow.com/a/3257340/633961 I am not married with…
guettli
  • 26,461
  • 53
  • 224
  • 476
6
votes
1 answer

How to concatenate multiple pdf as one, each input pdf starting on an even page?

DUPLICATE OF How can I merge PDF files (or PS if not possible) such that every file will begin in a odd page? I have a serie of documents, each one with an unpredictable number of pages. Say : a.pdf (1 page : A1) b.pdf (3 pages : B1, B2, B3) c.pdf…
Elvex
  • 586
  • 4
  • 21
5
votes
1 answer

ImageMagick pdf to black and white pdf

I would like to convert a pdf file to a Black and White PDF file with ImageMagick. But I've got two problems: I use this command: convert -colorspace Gray D:\in.pdf D:\out.pdf But this command convert only the FIRST page... How to convert all…
szuniverse
  • 990
  • 4
  • 16
  • 30
4
votes
2 answers

Calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf?

Getting or calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf? As a human I am able to calculate(whether it is replacing last Td or adding to last Td or multiplication with fontsize) the positions of tags in pdf content…
SuperNova
  • 15,051
  • 5
  • 67
  • 45
4
votes
6 answers

Merge Multiple PDF's into one PDF

I am having some issues with my code. I am trying to loop through a Drive folder that contains many PDFs and then merge these into one file. When I use my code it just creates a PDF for the last PDF in the Drive folder and not merge them all…
3
votes
3 answers

wrong encode when update pdf meta data using ghostscript and pdfmark

I have a base pdf file, and want to update the title into Chinese (UTF-8) using ghostscript and pdfmark, command like below gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=result.pdf base.pdf pdfmarks And the pdfmarks file (encoding is UTF-8…
Larry Cai
  • 45,222
  • 30
  • 104
  • 141
3
votes
3 answers

Splitting single page into two pages with ghostscript

I have a pdf with something like presentations slides and multiple slides per page. How can I use ghostscript to split the file so that there is one slide per page?
howardh
  • 614
  • 2
  • 7
  • 15
2
votes
1 answer

PDF File Manipulation (open a large pdf file, find a keyword, then save in which page was found, and then split those pages and merge them in one pdf)

I'm working on a project for a friend of mine. I want to find one specific keyword that is on multiple pages, and it has duplicates on other places on a large PDF file (40-60 pages and above) then save in memory in what page the keyword was found,…
gemgr
  • 43
  • 5
2
votes
2 answers

Edit or remove PDF header information in C

I need to edit the header information of several PDF files. What I'd like to achieve is to remove all header data before %PDF-X.Y.Z. What I came up with as a possible solution was to open the PDF in binary mode, read each character until %PDF-X.Y.Z…
Dominik
  • 117
  • 1
  • 10
2
votes
4 answers

Best way to change pagination of existing PDF

We have a PDF that is generated as A5 landscape pages. With that, we need to do a PDF with A4 portrait page format, by putting 2 pages of the source PDF on top of each other on each page of the result PDF. Do you know a good library that could do…
Peter Fox
2
votes
2 answers

How do I execute ghostscript from C# program

I am trying to call ghost script from my C# program, passing it some args to crop the footer of a PDF file, then overwrite the temp file with the new modified version. I think I'm calling the gs.exe incorrectly. Does anyone see a reason that the…
Frantumn
  • 1,545
  • 6
  • 32
  • 57
1
2 3 4