Generating index in pdf using table of content available in pdf - ghostscript

I have a pdf file basically RTC datasheet,
It is not allowing to jump to page using table of content and it doesn't have index or bookmark on the left side panel.
http://www.horustech.com.tw/WebMaster/FileData/Epson/RX8900SA(SA;CE).pdf
Now my question is it possible to update index/bookmark in this pdf using ghostscript or pdftk command ?

You could make a *new** PDF file, and you could add to that a new /Outlines tree (which I believe is called Bookmarks by Acrobat), but you would have to do it by creating a sequence of PostScript pdfmark operations. You would have to build those yourself, there's no way to do it automatically.
You could also (more difficult) /Link annotations to the table of contents so that it could jump to the relevant page/area. Again with Ghostscript you would have to do this by manually creating pdfmark operations.
Again, none of this can be done automatically, creating the pdfmarks would have to be done manually, especially the hyperlinks in the table of contents, those are almost certainly better handled using an interactive program, if you wanted to do that.
I'm reasonably sure you could do this with pdftk too, but again I think you would have to add the Outlines or Links manually.

Related

How to create a presentation using .svg files representing each slide

This question is motivated by the answer given in this question
Using the animate package without adobe
I want to create latex beamer presentations without relying on adobe, as it is a pain.
I followed the instructions given in the post's answer, and when compiling the given example code, the output were 4 .svg files, and I have no idea on what to do with them.
Something tells me they should be embedded into an html file that produce a slide-presentation, but I'm a complete noob in html and I've not been able to find an answer on how to achieve this.
No additional wrapper for the individual .svg files is necessary. Simply open the first .svg file in your browser and use the little arrows at the top right for navigation. They automatically link to the next slide.

Is there a way to link yet to be created images into an indesign layout?

I'm creating a multipage publication with many ads that haven't been built yet. I know their size, and filename, but the image/pdf doesn't exist yet.
Is there an existing script or a possible way to link an image that doesn't exist? Another way to look at this would be kind of the reverse of how the missing links (relink) button works. Where I know what the file path will be, but the file is missing.
Publishing industry standard practice:
Rather than a script, just create a blank image at the exact size. Make it florescent magenta with the letters "FPO" huge and dead-centre so no one can mistake it for the real thing.
Importantly: give this FPO image the exact file name of the file which will eventually be used/placed.
When your production image is finalized and approved, cut-and-paste the exact FPO file name into the new file. Drop the production file into your working directory overwriting the FPO file, and refresh it in InDesign. Bob's your uncle.
If this is being done to hundreds of images, you can develop your own batch process to handle this with some time-saving automation. However, this is a good example of an issue that can be solved at the production-management level, rather than at the coding level.
Hoping this helps!

Add page to multiple PDFs in batch without messing with fonts

I'm trying to use Ghostscript to append a PDF as "last page" to multiple other PDFs. The problem I'm encountering is that Ghostscript walks through the whole PDF and does a bunch of font substitution.
I'm using the following batch script:
FOR %%G IN (*.pdf) DO IF NOT %%G==lastpage.pdf gswin64c -sDEVICE=pdfwrite -sOutputFile="output\%%G" -dNOPAUSE -dBATCH "%%G" lastpage.pdf
Example Error:
Page 12
Substituting font Courier for GGCJBF+Courier.
I will also sometimes get other errors, like this:
jbig2dec FATAL ERROR decoding image: prevent DOS while decoding height classes (segment 0x00)
failed to create parsed JBIG2GLOBALS object.
**** Error reading a content stream. The page may be incomplete.
**** File did not complete the page properly and may be damaged.
All I need gs to do is append my lastpage.pdf to the existing PDFs without walking through the entire PDF I'm appending to, especially with font substitution, because I will not have most of the fonts other people are using in their PDFs.
Is it possible in gs to simply append without walking through every page of the PDF? Is there another tool that will allow appending of PDFs in batches without this issue?
You need to be aware that Ghostscript does not simply manipulate the incoming PDF file, so you aren't 'appending' a page. What it does is interpret the incoming file into marking operations, pass those to a device, and that device takes further action on them. Rendering devices write to a bitmap, pdfwrite reassembles the marking operations into a brand new file.
That's why it 'walks through the whole file', its the way it works. There are advantages to this (its possible to alter the file contents for example) and disadvantages.
Now if you are getting a font substitution for an embedded font, there's something wrong with the embedded font (or possibly you are using a really old version of Ghostscript with a bug). You could try a newer version of Ghostscript but you're never going to get away from processing the entire input file.
Why not try pdftk.

markdown or markup to powerpoint?

I need to maintain some slides in both latex beamer and in powerpoint. (This is to make slides available for instructors elsewhere, too, 90% of which do not know how to use latex and are unwilling to learn it. and I am a latex guy on linux.)
I have tried the route via Libreoffice (and opendocument), but this did not come out well. right now, the best method that I have found is to author pdf in beamer, then run it through a nuance OCR program to get MS Word...and not even go all the way to Powerpoint (which is where I really need to be).
If I only had a markup language that produced nice Powerpoint, I could probably code a perl translator from markdown to this intermediate markup language. (going from markdown to latex beamer is relatively easy.)
I don't think this exists, but hope springs eternal. after all, it is almost 2014 now. does anyone know of a solution?
One solution is to use odpdown: It converts markdown to the OpenOffice Presenter format, which can be imported into PowerPoint.
It is not yet complete, i.e. table support is missing and possibly not running on certain Windows setups, but nevertheless it could be a start. Possibly, you have Linux running, where it seems to work.
Steve Rindsberg's answer in the comments works on PP 2007 works! Let me repeat it here:
I suspect that PowerPoint is the likeliest solution. ;-) But what sort
of slides are you creating? If they're simple heading and bullet point
slides, all you need to produce is a simple text file. Any text that
starts in the left column will be the heading of a new slide. Indent
one tab and it becomes a first-level bullet point under the current
heading; indent two tabs, it becomes a second level bullet point and
so on. Simply use File | Open on the text file to pull it into PPT.
Steve: Is this all that PP converts? Or is there a reference of other "sneaky" markup that PP knows about?
(pandoc: unfortunately, the conversion from libreoffice to powerpoint is pretty poor when I tried it last. I also tried to save and understand the powerpoint xml format, but that was REAL bad.)
The easiest way to handle this is to work with:
RStudio (and R if not already installed)
RMarkdown
Pandoc 2.0.5 (minimum)
Install those 3 (or 4) items, then read: https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html
The installation time is worth the time saved copy-pasting everything from scratch.
I also am a Linux guy and I also use LateX engines to create nice documents. Based on my experience, here's what you should do :
Stop writing directly in LaTeX and start using org-mode to write documents instead (I spent years writing in LaTeX and now it's over (except when I use modernv package))
Org supports latex math formulas and .org files are easily exported in .tex files
Org can also be easily exported in markdown
Once you have your markdown, there are several tools that will allow you to create a PowerPoint. Two of them are pandoc and md2pptx

Modifying existing pdf elements (particularly images)

I am reading in template PDFs, customizing them, and appending pages before outputting the final document. What I want to do is modify the elements in the template I load before I append it to the output.
In particular I want to hide or remove images (and potentially other elements). I'm not even sure if elements in the imported page can be modified directly, if I can only add images (I haven't seen any sign of a removeImage() function) or what.
A little guidance would be greatly appreciated.
You should get hold of the book accompanying iText: iText in Action (1st or 2nd edition). It has some great examples of most things that can be done in iText.
Fist edition
Second edition
I believe you need to iterate through the pdf references in the reader to be able to identify images. I am not sure how one would replace them, but it's probably possible.
There are other libraries that do this better, pdfnet being one of them, but this is commercial.

Resources