PDF cannot open in Adobe InDesign #959
-
| I am using PyMuPDF for writing a text on PDF. I am successfully able to write text on PDF with this library. If I open PDF normally or Other Adobe software then It is working fine. Describe the bugIf I open an output PDF file in Adobe InDesign then it is giving an error that PDF cannot Open. To Reproduce1. I have tried with insertTextbox method. Expected behaviorI want to open a PDF file the normal way in Adobe InDesign. Thank you, | 
Beta Was this translation helpful? Give feedback.
Replies: 25 comments 1 reply
-
| Problem not reproducible like that. | 
Beta Was this translation helpful? Give feedback.
-
| Ah and of course the rest of mandatory information: your environment and PyMuPDF version. | 
Beta Was this translation helpful? Give feedback.
-
| Thank you for your fast reply. PyMuPDF version is 1.18.6. Yes as you told I have tried with insert_textbox() still PDF is not opening in Adobe InDesign. For example, can use any PDF. | 
Beta Was this translation helpful? Give feedback.
-
| operating system? | 
Beta Was this translation helpful? Give feedback.
-
| I am using macOS Mojave 10.14.6 Operating System. I hope this is enough information. | 
Beta Was this translation helpful? Give feedback.
-
| How do you save the modified PDF: garbage options?, deflate=True?,  Adobe InDesign is not a free product - it costs money - and I am not using it, nor will I buy it. So before using up this precious timeframe: | 
Beta Was this translation helpful? Give feedback.
-
| I am using this code to write text on PDF. I have tried garbage values from 1 to 4 but the output is the same (Cannot open PDF in Adobe InDesign). Yes, I am able to open a PDF file in Adobe Acrobat and Adobe illustrate also in google Crome and normal PDF viewers. If you have other code suggestions then also you can tell me I will try here and check also. Yes, I am also want to solve this issue soon. | 
Beta Was this translation helpful? Give feedback.
-
| Your code looks good! And thanks for the accompanying info. | 
Beta Was this translation helpful? Give feedback.
-
| Okay, I am really waiting for your answer. I hope we can solve this issue soon. | 
Beta Was this translation helpful? Give feedback.
-
| Installed Adobe InDesign. | 
Beta Was this translation helpful? Give feedback.
-
| Do you mean printed PDF from PyMuPDF or normal PDF? And one more time. You have to select Place from the menu. | 
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
| Can you tell me your full configuration? What version you are using for all software including InDesign? | 
Beta Was this translation helpful? Give feedback.
-
| Windows 10 64bit, Python 3.9 64bit, InDesign 16.1, PyMuPDF v1.18.8 By the way - as soon as I use a fontfile-based font, InDesign refuses to open the PDF. | 
Beta Was this translation helpful? Give feedback.
-
| Yes, you are right I am also able to open PDF in InDesign if I am using a font from Base-14 fonts. Can you give me any idea why it is not working with fontfile-based font? Because I want to use fontfile. also can you tell me that is there a way to vectorize our font before export it or save file? | 
Beta Was this translation helpful? Give feedback.
-
| The problem is larger than around fontfile. And it is InDesign-specific. So in summary, InDesign only accepts some subset of otherwise perfectly valid PDFs -- PDFs that can be opened in Adobe Acrobat and all other PDF viewers without restrictions I have no idea how this comes about and probably must be addressed / interrogated by InDesign. For you immediate needs you may want to convert your modified PDF to some image file -- page by page -- and them import these. | 
Beta Was this translation helpful? Give feedback.
-
| Yes, I got your point but Can you give me a way to make my font vectorized while writing it on PDF or on Saving time? | 
Beta Was this translation helpful? Give feedback.
-
| 
 Don't understand that. You could convert a PDF page to an SVG image and then import this one. This is a vector format and by defaut font-independent. | 
Beta Was this translation helpful? Give feedback.
-
| So for your clear understanding. So I want to make functionality like the text written by PyMuPDF will be not changed by any software. So is there any way to make text not editable by other software? | 
Beta Was this translation helpful? Give feedback.
-
| 
 Well, you can always password-protect a PDF and encrypt it such, that it can be read, but not changed by anyone without the password. What you meant amounts to not writing the text by using a font. Instead paint each character by elementary PDF drawing commands like a capital letter "D" is painted as a closed semi-circle. | 
Beta Was this translation helpful? Give feedback.
-
| BTW: the correct term is "text as path". Text written using a font, by definition is vectorized. | 
Beta Was this translation helpful? Give feedback.
-
| 
 Changing text no matter what you do is always possible. Even when written as paths. | 
Beta Was this translation helpful? Give feedback.
-
| I feel Well, you can always password-protect a PDF and encrypt it such, that it can be read, but not changed by anyone without the password. this is a good way to go and I want to try it. Can you give me an example code for this feature? Because we have permission, user_pw, and owner_pw | 
Beta Was this translation helpful? Give feedback.
-
| Use an owner password and encrypt the file with a method of your liking. perm = fitz.PDF_PERM_ACCESSIBILITY  # always start with this
perm |= fitz.PDF_PERM_PRINT  # then OR additional allowed actions into it
perm |= ...
doc.save("encrypted.pdf", owner_pw="owner", user_pw="user", permissions=perm, encryption=fitz.PDF_ENCRYPT_AES_256)The maximum password length is 50 bytes. | 
Beta Was this translation helpful? Give feedback.
-
| Hello, I need your small suggestion. I embedded this fond file inside our library then I want to access it by name in insert_textbox method. https://pymupdf.readthedocs.io/en/latest/font.html currently, I am not able to use that font in insert_textbox. Can you give me a code snippet for it? | 
Beta Was this translation helpful? Give feedback.

Windows 10 64bit, Python 3.9 64bit, InDesign 16.1, PyMuPDF v1.18.8
By the way - as soon as I use a fontfile-based font, InDesign refuses to open the PDF.
Choosing one of the Base-14 font (Helvetica, Times-Roman or Courier and their respective font weights) all works fine.