Hello,
I would like to know if a date is planned for PDF/A export in Typst ?
Thanks!
fdekerm
Looking through recent Discord discussion:
We are looking to release 0.12 soon with PDF/A support and build on that for 0.13, which is the target for tagged PDF, not neccessarily PDF/UA-1. Note that /UA-1 compliance cannot be achieved fully automatically, we need some input from the users as e.g. what do your pictures show, what role a figure plays, and more.
– @reknih, 2024-09-13T22:00:00Z; on Discord
And there is a freshly open PR: Minimal PDF/A support by laurmaedje · Pull Request #5075 · typst/typst · GitHub
So apparently it’s not going to be too long!
EDIT: as this is the accepted answer, I want to mention that the rest of the thread has a lot of discussion on various subsets of PDF/A. The standard that has been implemented in the PR is PDF/A-2b, but there are more restricting subsets of PDF as well.
Great! I hope it happens soon, I wrote my thesis in Typst and my university only asks for PDF/A files …
If it’s really urgent, there are other tools you can use to convert a PDF to PDF/A, though (for example ghostscript).
I’ve tried, but with the command found here (convert-pdf-to-pdf-a-or-pdf-x), ghostscript generated a 160MB file (compared with 36MB for the original) in which the text is no longer selectable (as if each page were an image).
Oh hmm… No idea why that happens, not familiar enough with ghostscript. :/ It worked fine with the simple document I tried.
Could you tell us which version of ghostscript you are using? Also, do note that any transparency layer will be rendered as images in PDF/A-1.
The use of transparency is forbidden in PDF/A-1.
You may try using -dPDFA=2
for PDF/A-2 or 3 for PDF/A-3. Transparency is a feature of PDF/A-2.
Thanks for the answer, indeed it works with -dPDFA = 2. I’m using version 9.55.0.
However, I have another error:
GPL Ghostscript 9.55.0: Text string detected in DOCINFO cannot be represented in XMP for PDF/A1, discarding DOCINFO
GPL Ghostscript 9.55.0: Text string detected in DOCINFO cannot be represented in XMP for PDF/A1, discarding DOCINFO
The output is therefore not in PDF/A format at all. I tried to directly generate the PDF in PDF/A with Typst 0.12-rc1, but still got the same warning.
Note also that the PDF/A generated directly with Typst 1.12 ( typst compile --pdf-standard a-2b main.typ
) is not recognized as valid by my university’s submission software.
Do you know which exact standard your university requires? It could be something beyond A-2b.
Other than that, it would be interesting to know whether your document fails validation with verapdf. This is a command line Java application that can produce conformance reports for PDF/A files. If you want, you or we can try that (the latter of course only if you can share the document).
Would you be able to give us the full command? Looking at the error, I’d say you should probably remove -dPDFACompatibilityPolicy=1
from the arguments.
Thanks for the advice!
I installed it and the pdf passed the PDF/A-2B validation profile:
Maybe it comes from my university, I will ask them
The command was
gs -dPDFA=2 -dBATCH -dNOPAUSE -sProcessColorModel=DeviceRGB -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=1 -sOutputFile=output.pdf PhD_manuscript.pdf
When -dPDFA=1
, all pages was converted to images.
When -dPDFA=2
AND -dPDFACompatibilityPolicy=2
, I have to following error and the document is no longer generated:
GPL Ghostscript 9.55.0: Text string detected in DOCINFO cannot be represented in XMP for PDF/A1, aborting conversion. GPL Ghostscript 9.55.0: Unrecoverable error, exit code 255 GPL Ghostscript 9.55.0: ERROR: A pdfmark destination page 215 points beyond the last page 1.
What about -dPDFA=2 -dPDFACompatibilityPolicy=1
, or only -dPDFA=2
?
From what I understand the value of PDFA
and PDFACompatibilityPolicy
have nothing to do with each other. PDFACompatibilityPolicy is simply telling ghostscript how to behave in case of PDFA violations.
See PDFACompatibilityPolicy | PDF Optimizer
- 0: (default) Include the feature or operation in the output file, the file will not be PDF/A compliant.
- 1: The feature or operation is ignored, the resulting PDF file will be PDF/A compliant. A warning will be emitted for every elided feature.
- 2: Processing of the file is aborted with an error, the exact error may vary depending on the nature of the PDF/A incompatibility.
Aside from installing veraPDF, you can validate PDFs compliance with:
- the online veraPDF demo: https://demo.verapdf.org/
- (offline) the docker image: https://hub.docker.com/r/verapdf/rest
- Online alternative with a french institution: https://facile.cines.fr/
The last one is actually used to validate >=PDF 1.4 compliance for all french PhD theses.
Didn’t know about the online VeraPDF thing. That’s good to know!
not the OP here, but many institutions and companies require A-1b (I guess because it’s the most restrictive). Archivists, libraries, contracts, digital signed papers … It would be awesome if you could support A-1b
here two example pages, that explain their requests (in german):
PDF/A-1b is almost 20 years old. Even PDF/A-2b is 13 years old. Demanding PDF/A-1b seems unreasonably restrictive.
If they truly require PDF/A-1b there are tools that can do the conversion for you.
no, unfortunatly there are no tools, that can do that. ghostscript sometime can do. but it’s a hit and miss. but if you have some tipps, let’s try it…
I think you could create a new topic with the question “How do I convert my PDF to PDF/A-1b?” if you need help converting your document to PDF/A-1b, or directly create an issue on Issues · typst/typst · GitHub with a feature request for PDF/A-1 support to discuss that particular bit.
Technically speaking, there is no requirement to “upgrade” from PDF/A-1 to PDF/A-2 as there is no succession. PDF/A-2 does not replace or supersede PDF/A-1. I can find well-known institutions asking specifically for PDF/A-1:
- MIT: Saving Your Thesis as a PDF/A-1 - MIT Thesis FAQ - LibGuides at MIT Libraries
- Warwick College: PDF/A format for final thesis
- Memorial University: Thesis Help | Mathematics and Statistics | Memorial University of Newfoundland
In any case, I feel like this topic disgressed too much probably. As said above, it might be good to split it.
Thank you all for your replies!
Indeed, the university did ask for a file in PDF/A-1b format (but without explicitly mentioning it anywhere ). I ended up () using the trial version of Adobe Acrobat Pro to convert the 2b file into 1b. Unfortunately, some artifacts appeared. Nothing too serious, but quite frustrating when you’ve spent so much time adjusting everything.
I admit that this is the first real hitch I’ve encountered with Typst so far. I don’t know how widespread the 1b standard is, but until it’s possible to export natively in 1b, I’ll find it hard to recommend Typst to other PhD students in my team (which I’ve done regularly up to now).
Thanks again for your amazing help !