I have a PDF and I want to programmatically change text, not fonts, colors, just letters.
I tried
pdf-toolkit - just metadata
prawn - templates not supported any more
combine_pdf - some fonts not supported
Is there easier way to change just text?
Just decode the XML inside the PDF file, change a encode back?
Related
I have used ![](https://image.png){width=25px} for inline image but it seems not working with .svg image.
Is there any way that I can use this image in my rmarkdown?
You could use the R package rsvg to convert the SVG to PDF
rsvg::rsvg_pdf(svg = "https://upload.wikimedia.org/wikipedia/commons/1/15/Florida_in_United_States.svg",
file = "image.pdf")
and then include that PDF as you're used to
![](image.pdf){width=25px}
You could also convert the SVG to another image format supported by knitr using the other rsvg::rsvg_* converter functions, e.g. to PNG via rsvg::rsvg_png(). But I'd recommend to stick with vector image formats like PDF or EPS since they will print in crisp sharpness.
Note that if you install rsvg from source (likely the case on Linux), additional system dependencies are required.
I know Ghostscript can translate pdf into png.
Can you tell which lines in the source code to comment out so that blocks with text are simply skipped (ignored) when converting pdf to png.
Don't modify the source. Instead use -dFILTERTEXT which will drop text rather than rendering it. See here
Pandoc can easily render the same source file to html or LaTeX and then pdf. In many cases, I'd like to use different versions of the same image file depending on which backend is being used: When the original "image" is a vector figure, possibly containing text (e.g. PostScript, PDF, maybe SVG), I'd like to use that version to generate LaTeX and PDF, so there's not loss of quality. But browsers don't generally render those well, so I'd like to generate and use a raster (e.g. PNG) image when generating HTML.
Is there any way to do this in Pandoc? What I was hoping would "just work" was something like the \includegraphics{} LaTeX macro where, if you provide the filename with no extension, it identifies all the image files matching that stem and applies some heuristic to pick the best option.
You could call pandoc with --default-image-extension=png when generating html, and --default-image-extension=pdf (or whichever other extension you use) when generating the pdf. See
https://pandoc.org/MANUAL.html#reader-options
I'm seeing some images online that end in .png but appear as GIF. How is this possible?
Example:
https://www.khanacademy.org/computer-programming/loading/6267221601681408/5689792285114368.png
This is a GIF file, with an .png extension. Though the extension is "wrong", many image viewers (including browsers) can still it interpret them correctly because they don't believe blindly what the extension says (remember that the "extension" is just a hint), but they look into the image content. The first bytes of most common image formats allow to easily identify the image type. In this case, you can check (looking at the image content, say, in some hexadecimal editor/viewer) that the file content starts with the ASCII characters "GIF89a".
I am writing a report in markdown which contains many figures generated in .pdf format. when converting to html using pandoc these images are inserted as objects in a very small box.
My question is whether it is possible to render them as pandoc would for .png for instance.