| <<<Back 1 day (to 2018/05/05) | 20180506 |
drozdziak1 | Could someone recommend me a channel for general PDF questions? I'm looking to add a centered, large title to my PDF file, but had no success in boring through the reference document to do this. | 20:11.15 |
rayjj | drozdziak1: both Artifex Software (open source AGPL) packages can do this. Ghostscript can be done with a simple prefix PostScript script, and mupdf can do it from C programmaing, although there is may be more of a startup to learn how to do it with pupdf | 20:34.10 |
| s/pupdf/mupdf/ oops :-) | 20:34.29 |
| I am more familiar with Ghostscript and have done things like watermarks over PDF pages a lt of times | 20:35.10 |
| sorry for the typos. This KB is not my usual | 20:35.37 |
drozdziak1 | rayjj Thanks for responding. My general need is to understand the concepts behind PDF structure while not getting overwhelmed by the reference's complexity. I've got a fairly low-level Rust library (lopdf) that takes care of content length correctness for me, but I simply don't know how to take advantage of that well yet | 20:36.41 |
rayjj | In terms of general PDF, you need to add an object (usually a Form XObject) and have the Contents invoke it | 20:36.52 |
drozdziak1 | rayjj The reference mentions a `TextAlign` field for some objects, but I'm not sure which object type I want. | 20:38.04 |
rayjj | So depending on what the Form Xobject is going to draw, you may need to add other XObjects (other Forms, Images, Fonts, or other Resources such as ColorSpace | 20:38.20 |
| TextAlign sounds like an Annot TextBox widget thingy | 20:39.01 |
| Once again. Ghostsript takes care of creating al the objects you need, but you may not need/want an Annotation | 20:40.26 |
| since PS can center text horizontally | 20:41.00 |
| (using charpath pathbbox) | 20:41.20 |
| and some math operators | 20:41.35 |
| or center a box on a page using pathbbox | 20:42.04 |
| and doing it with GS or MuPDF is not trivial, but also not extreme rocket science | 20:42.56 |
| drozdziak1: I don't think understanding PDF's structure is the main issue. The complexities of that are better left to packages. Contents, or even Objects can be compressed and/or encrypted, so you can't just "edit" a PDF. | 20:45.21 |
| and depending on what you want, even deciding how to put it in the PDF (what type of thingy) requires some knowledge of how PDF readers work | 20:46.42 |
| (Acrobat being the most common, but even Acrobat is not consistent across versions) | 20:47.29 |
| drozdziak1: from what I can tell of the Rust Iopdf, it is VERY low level, and being that it is 0.9.0 (afaict) I'd go with something more capable | 20:52.03 |
| but if you are comfortable with dealing with PDF objects, then mupdf gives you more control of things than Ghostscript | 20:53.12 |
| Forward 1 day (to 2018/05/07)>>> | |