Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, all

 

I have a peculiar problem that I cannot figure out. In Excel I have a procedure that takes defined output range and print this to a pdf-file. The script works fine, the only problem is that the output is rotated 90 degrees to the left! The consequence is that I have to manually errect this by clicking into the file, select rotate and tweak it to the right. This should be very unnecessary! I have tried to alter the output range, changed from landscape to portrait and so on, but with the same result. The script I�ve used is stated below. What I�d like is to build in some sort of control function so that what I see on the screen is in the same form and shape in the pdf output file - which should be landscape and on two pages. Hope you can help�

 

Sub PrintOut()

 

Dim PSFileName As String

PSFileName = "C:\abc\myPostScript.ps"

 

ActiveSheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", PrintToFile:=True, collate:=True, PrToFileName:=PSFileName

 

Dim PDFFileName As String

PDFFileName = "C:\abc\myPDF.pdf"

 

Dim myPDF As PdfDistiller

Set myPDF = New PdfDistiller

myPDF.FileToPDF PSFileName, PDFFileName, ""

 

Kill "C:\abc\myPostScript.ps"

 

SourceFile = "C:\abc\myPDF.pdf"

 

Filename = "Test " & ".pdf"

FilePath = "C:\abc\"

DestinationFile = FilePath & Filename

 

FileCopy SourceFile, DestinationFile

 

Kill "C:\abc\myPDF.pdf"

 

End Sub

:confused: :confused: :confused:

  • 2 years later...
Posted
Hello,

 

I am having the same problem you have here did you ever find an answer to get it to rotate back the way it should be?

 

Thanks,

Hank.Sutherland@Newellco.com

 

Hi Hank,

 

No, not really. Have not found a way to controll the orientation. But I discovered that the same script gave different results as to orientation on other workstations. Go figure :)

  • 3 years later...
Posted

Hi,

 

Not sure if this is useful or not but it maybe part of the issue. Unlike Word, Excel etc Acrobat does not base it's page coordinates from the top left of a page but rather from the bottom left.

 

e.g. If I want to put a 3pt * 3pt square shape into word that is 2 pt in and 6pt down I'd use:

 wdDoc.Shapes.AddTextbox(1, 2, 6, 3, 3).Select() 

 

However in Acrobat, I'd have to find the height of the Page, set the top value as the page height - 6, then specify the bottom value as pageheight -9 (6+3)

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...