Pdf – How to remove URL embedded in PDF document? (dialog “the document is trying to connect to” appears)

embeddedpdfSecurityurl

I have an Adobe PDF document which when opened displays a warning dialog with the words "the document is trying to connect to" followed by a certain URL.

I choose the "Block" option to try to be safe.

But I'd rather not have this dialog displayed at all, or for the PDF document itself to contain the URL. Connecting to the URL is unnecessary for the document to be useful – it's contents can still be read when "Block" is chosen.

I'm not looking for a solution that addresses the symptom – i.e. the dialog – so I'm not looking for a solution that simply says something like: "change security settings to block on default" or something like that.

The solution I am looking for is to simply remove the URL mentioned in the dialog, from the actual PDF document, so that the dialog never occurs.

My first attempt at this solution was to open the PDF in the Notepad++ text editor (any text editor would suffice, if it has search). Then I searched for the URL mentioned in the warning dialog.

Here is the snippet of the PDF code from the PDF document itself, showing the URL

PDF snippet

This only occured once in the document. So I experimented with removing various bits: just the URL to leave () and then the whole snippet.

In all experiments with removing the URL and associated code, the warning dialog disappeared but instead Adobe Reader reported:

"the file is damaged but is being repaired"

and the PDF file still loaded and was displayed.

But obviously I'm looking for a solution that removes the URL without causing this other dialog to occur. Presumably my manual edit disturbed the code somehow, maybe a checksum or a offset position value became inconsitent with the actual position of some code.

So, is there a utility to strip/filter/remove such embedded URLs in PDFs with the resultant document intact without errors?

(By the way, I had to show the code snippet as a image as the it would not get displayed completely due to the double angled equality brackets being interpreted as markup I guess. The URL given was an example to illustrate the problem and not the actual one seen.)

Best Answer

PDF file contains a table with file offsets at the end, and they go wrong if you remove the URL.

You can replace it with spaces, preserving the count of characters (preferably in hex editor), and it should work fine.

Overwrite the

/S/URI/(http://....afile.exe)
with spaces and leave the braces around intact, like this:
7210 0 obj
<<                                            >>
endobj xref
(it's the "object reference", you don't want to change it because the offset table would go wrong)

Or, you can look for a PDF editor, but I believe this would be overkill.

Please post your results :)

Related Question