lubracali
9th Jan 2011, 10:00 pm
Hello
I wrote this code to create pdf from a design by specifying which area of the drawing must be printed.
The code works, but the file is always in the format "A4".
How can I define a custom format with vba, that is not present in the default format for the printer?
Each print has a size different from the others and I wish the paper was the same size and proportions of the printed design.
I hope I explained myself well because my English is bad.
If not I'll try to explain better
This is the code
Private Sub cmdPdf_Click()
Dim stampa As AcadPlot
Dim nBACKGROUNDPLOT As Long
nBACKGROUNDPLOT = ThisDrawing.GetVariable("BACKGROUNDPLOT")
nBACKGROUNDPLOT = ThisDrawing.GetVariable("BACKGROUNDPLOT")
Dim num_prova As Integer
Dim x_origine As Double
Dim y_origine As Double
Dim origine_testa_y As Double
Dim ptA(0 To 2) As Double
Dim ptB(0 To 2) As Double
Dim puntoA As Variant
Dim puntoB As Variant
num_prova = txtNumProva.Text
x_origine = 200 + (num_prova * 200)
y_origine = 200
origine_testa_y = y_origine + 62.5
ptA(0) = x_origine + 14.4325
ptA(1) = y_origine + 7.1914
ptB(0) = x_origine + 104.4325
ptB(1) = origine_testa_y + 51.7515
puntoA = ptA
puntoB = ptB
ThisDrawing.ActiveLayout.CenterPlot = True
ThisDrawing.ActiveLayout.StandardScale = acScaleToFit
ThisDrawing.ActiveLayout.GetWindowToPlot puntoA, puntoB
ThisDrawing.ActiveLayout.PlotType = acWindow
Set stampa = ThisDrawing.Plot
stampa.PlotToDevice ("Adobe PDF")
Call ThisDrawing.SetVariable("BACKGROUNDPLOT", nBACKGROUNDPLOT)
End Sub
I wrote this code to create pdf from a design by specifying which area of the drawing must be printed.
The code works, but the file is always in the format "A4".
How can I define a custom format with vba, that is not present in the default format for the printer?
Each print has a size different from the others and I wish the paper was the same size and proportions of the printed design.
I hope I explained myself well because my English is bad.
If not I'll try to explain better
This is the code
Private Sub cmdPdf_Click()
Dim stampa As AcadPlot
Dim nBACKGROUNDPLOT As Long
nBACKGROUNDPLOT = ThisDrawing.GetVariable("BACKGROUNDPLOT")
nBACKGROUNDPLOT = ThisDrawing.GetVariable("BACKGROUNDPLOT")
Dim num_prova As Integer
Dim x_origine As Double
Dim y_origine As Double
Dim origine_testa_y As Double
Dim ptA(0 To 2) As Double
Dim ptB(0 To 2) As Double
Dim puntoA As Variant
Dim puntoB As Variant
num_prova = txtNumProva.Text
x_origine = 200 + (num_prova * 200)
y_origine = 200
origine_testa_y = y_origine + 62.5
ptA(0) = x_origine + 14.4325
ptA(1) = y_origine + 7.1914
ptB(0) = x_origine + 104.4325
ptB(1) = origine_testa_y + 51.7515
puntoA = ptA
puntoB = ptB
ThisDrawing.ActiveLayout.CenterPlot = True
ThisDrawing.ActiveLayout.StandardScale = acScaleToFit
ThisDrawing.ActiveLayout.GetWindowToPlot puntoA, puntoB
ThisDrawing.ActiveLayout.PlotType = acWindow
Set stampa = ThisDrawing.Plot
stampa.PlotToDevice ("Adobe PDF")
Call ThisDrawing.SetVariable("BACKGROUNDPLOT", nBACKGROUNDPLOT)
End Sub