Closed harveyspecter09 closed 4 years ago
Sure. By using one of the text insertion methods, you also reference a font one way or another. That font will then be automatically embedded in the PDF upon save.
@JorjMcKie thanks for your quick response to be precise below are my concerns appreciate your solution at your earliest convenience.
fitz.TextWriter
class.For topic 3 there exists some sort of an "approximation" (!) when you use redaction annotations:
page.getText("dict")
which delivers all properties of each text piece ("span"). Subselect txt pieces contained in that paragraph.page.apply_redactions()
. This will remove the paragraph (or, rather everything inside its rectangle).The approach in previous post can of course also be used for the full page:
You would probably need a table upon which you would base font replacement decisions.
Here is a quick draft of something that reads a PDF and write a new PDF with the following features:
Use it as a starting point. The following aspect are not (yet) covered:
Can probably be extended to arrive at a pretty good approximation to your intentions.
@JorjMcKie appreciate your feedback thanks a lot
hi @JorjMcKie hope you are doing good today. i am a learner out of college
I have tried to build a piece of code with your fitz package probably you can take a look,will be grateful & appreciate your suggestions.
Input - PDF(Helvetica,Helvetica-Bold) Expected Output - PDF(Courier-Bold Helvetica-Bold) Actual Output - PDF(['Font Type: Type0, Font Name: Courier-Bold, Encoding: Identity-H', 'Font Type: Type0, Font Name: (null), Encoding: Identity-H']) missing some characters as well compared to input.
Is there any way that you can help me in successfully fetching all data including images,drawings?
Scenario: Given a PDF , read the current font embedding and convert its encoding from one format to other. by using your awesome package am able to read current font embedding but unsure on how to change encodings any leads on its implementation?
Scenario : Given a PDF, raise exceptions for irregular font encoding(custom encoding)/irregular font embedding(unembedded fonts) for further processing.
thanks in advance.
can we embed new fonts for an existing pdf using this package?