Command Line: open a PDF *and* change to spcifified page?

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

Hallo!

I would like to create links in my file system to big PDF-files (e-books) and specify, which page to show, when double-clicking this link.

eg: PDFXCview.exe c:\folder\e-book.pdf;123 --> opens e-book.pdf and shows page 123 instead of the first page.

Is this possible right now? Otherwise, might this be implemented in the next release?

Michael
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by Ivan - Tracker Software »

Yes, it is possible.
Check help file for command line parameter /A.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

Which help file? F1 -> Introduction -> Command Line:

"Command Line option

The PDF-XChange Viewer may be started with a PDF file or URL name as the first item on the command line. This facilitates starting the Viewer in File Associations or using Windows ShellExecute.

The form of the command line for using this option is:

"C:\Program Files\Tracker Software\PDF-XChange Viewer\PDF-XChange Viewer\PDFXCview.exe" "%f"

(the path given above is an example and not definitive - please locate and confirm the actual installation path on your system)


Note that the PDF file/URL is represented by "%f" with double-quotes. These are necessary when the form of the file name may have spaces or other symbols in it that otherwise prevent proper parsing of the command line.

At the current time there is no "print option" available on the command line."
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by Ivan - Tracker Software »

Can you say build number of the viewer do you use ?
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

The very latest: V2 b40.5
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by Ivan - Tracker Software »

Looks like wrong version of help file included into installation of the viewer -- will fix this.

Complete list of command line options now looks like:

Code: Select all

PDFXCview.exe [command] [filename1] [[filename2] […[filenameN]]]
Where command can be one of the following commands:
	/A "param=value[&param2=value[&...]"
	/close[:save|discard|ask]
	/print[:[default=yes|no][&showui=yes|no][&printer=<printername>][&pages=<pagesrange>]]
	/printto[:[default=yes|no][&showui=yes|no][&pages=<pagesrange>]] <printername>
	/exportp <setting_file_name>
	/importp <setting_file_name>
	/RegServer
	/UnregServer
	/makeassoc
	/makeiassoc
	/storeassoc
	/restoreassoc
Where:

Code: Select all

/A
	Defines layout for document. Can contains one or more parameters:
		page=<page_number>
		zoom=<scale>[,<left>][,<top>]
		view=<keyword>[,<position>]
			keyword defines fit mode, and can be one (some has optional arguments):
				Fit
				FitB
				FitH,top
				FitV,left
				FitBH,top
				FitBV,left	
	viewrect=<left>,<top>,<right>,<bottom>
	pagemode=bookmark|thumb|none

	Example:
		PDFXCview.exe /A "page=10&zoom=200,,500" mypdffile.pdf

/close
	When this command is used, viewer will close files specified by arguments <filename1>…<filenameN>. If any of these files was modified, behavior of the viewer depends of command parameter (save, discard or ask). If save parameter was used, documents which should be closed will be saved. If discard was used – all modifications will be lost. And with ask argument, viewer will ask what to do.
	If all files opened into the viewer will be closed by /close command, application will be closed too.

/print
	When this command is specified, PDF file(s) specified by parameters <filename1>…<filenameN> will be printed. Printing parameters differ depending on arguments used:
		default=yes|no
			If this argument is used and its value is yes, viewer will reset printing settings before printing documents. Otherwise if the last is used, stored parameters will be applied. Default value: yes.
		showui=yes|no
			Defines if printing progress will be shown. Default value: no.
		printer=<printername>
			Specifies the printer on which documents should be printed. If not specified, default system printer will be used. Please note, if printer name contains spaces or & character, it should be enclosed into quotes.
		pages=<pagesrange>
			Specifies the pages range(s) which should be printed. Syntax of range is the same as on print dialog. If argument is omitted, all pages will be printed.

	Example:
		PDFXCView.exe /print:showui=yes c:\mydocument.pdf

/printto
	Almost the same command as /print, but destination printer should be specified not as command argument, but as command line parameter followed by /printto command.

	Example:
		PDFXCView.exe /printto "Raster-XChange" c:\mydocument.pdf

/exportp
	This command exports current viewer’s settings into the file specified by setting_file_name parameter.

/importp
	This command imports viewer’s settings from the file specified by setting_file_name parameter. Please note, all your current settings will be overridden and lost.

filename1, filename2, … filenameN
	PDF file name(s) which should be opened, closed or printed. Please note, if filename contains spaces, it should be enclosed into quotes ("")

/RegServer, /UnregServer
	Special commands used for registering and unregistering viewer’s COM interfaces.

/makeassoc
	Makes PDF-XChange Viewer as default PDF-viewer.

/makeiassoc
	Enables displaying PDF in Internet Browsers by PDF-XChange Viewer.

/storeassoc
	Stores existing PDF-associated application (if it is not PDF-XChange Viewer) that can be restored in the future.

/restoreassoc
	Restores a previously stored PDF-associated application.[/list]
HTH.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

Thanks!

For your information: Because Windows does not allow links like

/A "page=10" "myfile.pdf"

I changed the application call like this:

[HKEY_CLASSES_ROOT\PDF-XChangeViewer.1\shell\open\command]
@="\"C:\\Programme\\Tracker Software\\PDF-XChange Viewer\\pdf-viewer\\PDFXCview.exe\" \"%2\" \"%3\" \"%1\""

Now my links can be like this:

"myfile.pdf" /A "page=10"

Maybe it makes sence to allow the following syntax as alternative:

PDFXCview.exe file1 -switch

where a useful switch would be -page[n]

to allow PDFXCview.exe file1.pdf -page2
But this is only a suggestion.

Once more many thanks for this great tool and the really great support!!! :-D

Michael
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by Ivan - Tracker Software »

For your information: Because Windows does not allow links like
/A "page=10" "myfile.pdf"
Why do you think so? :shock: :!:
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

Try to create a link of a pdf-file (press SHIFT and CTRL while drag-and-drop) and then add

/A "page=2"

before the filename. Windows will shop up an error message.
guebert
User
Posts: 159
Joined: Sun Apr 06, 2008 7:05 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by guebert »

BTW, a feature like drag-and-drop a "current" view to windows desktop, which creates a link like mentioned above would be useful. (automatically create a bookmark and add this to the link).

Even better: "Save current view as" ... with file-dialog to enter a "file name". There should be a hint, that the base pdf must not be moved or renamed ...

Michael
User avatar
BigMike
User
Posts: 310
Joined: Wed Nov 07, 2007 10:07 am

Re: Command Line: open a PDF *and* change to spcifified page?

Post by BigMike »

guebert wrote:Try to create a link of a pdf-file (press SHIFT and CTRL while drag-and-drop) and then add

/A "page=2"

before the filename. Windows will shop up an error message.
Just create a shortcut to PDFXCView.exe and add the commandline options (/A "page=2" "filename" in your case) afterwards.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: Command Line: open a PDF *and* change to spcifified page?

Post by Ivan - Tracker Software »

Yes, shortcut with parameters should be for the application, not the file.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.