Liezzzje
Liezzzje

Reputation: 430

AcroPDF in Delphi - How do I scroll?

I'm currently adding a PDF viewer in a Delphi program using TAcroPDF. My problem is, the touch screens that need to show the PDF are rather small, so I wanted to add bigger buttons for scrolling.

I thought I could use the function ScrollBy(DeltaX, DeltaY), but the function scrolls the component within it's container in stead of scrolling the document itself.

Is there some way to scroll the PDF document?

Upvotes: 1

Views: 5460

Answers (3)

hello_earth
hello_earth

Reputation: 1562

there is another version of official documentation (Intercommunication Communication API reference) in PDF format here. It points out the following convenient method for scrolling and zooming at the same time:

SetZoomScroll

Sets the magnification according to the specified value, and scrolls the page view both horizontally and vertically according to the specified amounts.

Syntax void setZoomScroll(FLOAT percent, FLOAT left, FLOAT top);

I tried it in .NET 3.5 with C# and VS2010 Express and it works quite faithfully.

Upvotes: 0

jrodenhi
jrodenhi

Reputation: 2237

If you are up for rolling your own viewer, take a look at the QuickPDF Library. They have a RenderPageToStream function that will create a reliable image of your document in one of several different formats including BMP, JPG and TIFF among others. It's a decent solution and I have used it for printing fairly faithful versions of filled-in scanable government forms and have received no complaints from the government agencies where I have submitted them.

Upvotes: 2

Leo
Leo

Reputation: 38190

PDF browser controls are available through the AxAcroPDFLib.AxAcroPDF interface (TAcroPDF is just a pdf.ocx Wrapper), which provides, amongst others, the method SetViewScroll. This could be the way to go.

Unfortunately, the official documentation really sucks (for instance, the page for SetViewScroll actually describes SetViewRect... wtf?), you will have to do some testing...

Other methods that could be interesting for you are:

  • GotoFirstPage
  • GotoLastPage
  • GotoNextPage
  • GotoPreviousPage
  • SetCurrentPage
  • SetView
  • SetViewRect

Upvotes: 0

Related Questions