Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save Print To location from VB.NET

New Here ,
Nov 16, 2021 Nov 16, 2021

Hello,

 

We have a VB.NET application that opens PDFs for editing and a feature I am working on is using the Print To function to save selected pages to a new PDF, but we do not want the user to dictate where the file gets store. So what we want is to detect the Print To of the open PDF and control the actions of naming the file in a specific folder without the user seeing it happen.  All they shouold see is a message that says the selection was saved.  

 

Is this possible? 

 

Thank you,

Anthony

TOPICS
Edit and convert PDFs , How to , Print and prepress
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 17, 2021 Nov 17, 2021
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2021 Dec 08, 2021

Thank you.  My application opens PDFs and it is from those files that I want to force the Print To function to save to a specific location.  This location is static to the application, but the user should not be navigating to this location to make updates.  The application serves as the only method for creation and maintenance. 

 

From my application I am using Process.Start to open the PDF and I am using a watcher for subsequent edits.  I do that because the files on the server are copied down from a secure server and the saves on the local copy are then pushed back to the server so all is in sync. 

 

Ths code: 

 

Process.Start(sFileName) 

'Add the file to the Watch file list.
WatcherFileList_Add(sFileName)

MasterWatcher = New FileSystemWatcher(Path.GetDirectoryName(sFileName), Path.GetFileName(sFileName).Trim)
MasterWatcher.EnableRaisingEvents = True
MasterWatcher.NotifyFilter += NotifyFilters.Attributes
MasterWatcher.NotifyFilter += NotifyFilters.Size
MasterWatcher.NotifyFilter += NotifyFilters.LastAccess
MasterWatcher.NotifyFilter += NotifyFilters.LastWrite

AddHandler MasterWatcher.Changed, AddressOf WatcherSave
Thread.Sleep(StartUp.nSleep)
'start monitoring the file to see if it is still open or not
While StartUp.OpenFileTest(sFileName)
'pause for a time to ease CPU usage
Thread.Sleep(StartUp.nSleep)
Application.DoEvents()
End While

MasterWatcher.EnableRaisingEvents = False

 

Thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2021 Dec 08, 2021

In your application, you need to manipulate the registry as indicated in the Acrobat API documentation (linked to from my article, but unfortunately moved by Adobe, the new link is here: https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%... before you issue your print command. Make sure you also look at Kevin's comment on my blog post.

 

How this exactly works in your application is something you need to figure out. I provided sample code that should get you started, but how to do that in VB.NET is not something I am familiar with. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 08, 2021 Dec 08, 2021

You should under no circumstances be printing PDF to PDF. There is a better way in almost every case. To make a new PDF from selected pages, use the Acrobat Pro API to copy pages to a new document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2021 Dec 08, 2021

To be clear, this is a case where a person selects multiple pages in one PDF and then selects Print To or Save to a new PDF. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 08, 2021 Dec 08, 2021
LATEST

Thanks, that's what I guessed. And this is absolutely the wrong way to get a new PDF with a selection of pages, in every case. Please see my suggested solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines