Problems when trying to use large custom sheet sizes

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
kale
Posts: 6
Joined: Mon Jul 31 2006

Problems when trying to use large custom sheet sizes

Post by kale »

Hello!

My goal is to develop an application that would be able to plot AutoCAD drawings to PDF using large sheets sizes - the maximum size would be about 841 mm x 15000 mm. I'm trying to accomplish this with Amyuni PDF Converter 1.5, but I have a couple of problems.

(1) I tried to print these large sizes, but I noticed, that the largest size I'm able to print, is 841 mm x 5080 mm. I was quite surprised because of this, and started to search something technical limits from the manual of PDF Converter. I didn't found anything related to them. I read through your technical notes and this forum, still nothing. Then I downloaded the PDF 1.6 specification, and it revealed me the implementation limits of Adobe Acrobat (which I really can not understand, but anyway, they exist). In the specification they tell that the maximum size you can have with PDF 1.5 and/or Acrobat 6 is the 5080 mm x 5080 mm. They also tell, that with PDF 1.6 and Acrobat 7, the user space units can be scaled with a factor between 1 - 75000. With a value of 3, the PDF user space units could be scaled enough to represent the maximum sheet size I need.

I noticed, that PDF Converter is not able to produce a sheet of even the size of 5080 mm x 5080 mm. As my first question I would like to know, which are the exact limits of the PDF Converter 1.5. I also want to know, if the newest version of PDF Converter is able to print larger sheet sizes by utilizing the scaling capability of PDF 1.6, and if so, does it affect to the accuracy of the plotted drawing or are the drawings still able to be presented with an accuracy that equals the one that is currently possible? And if this capability is not present in the newest version of the PDF Converter, do you have plans to implement it, and if so, how soon? I just quickly searched through the PDF specification, I didn't have time to start to read it.


(2) I'm testing the PDC Converter with Excel 2003 VBA. Is there something wrong with this code:

Code: Select all

 Dim PDFPrinter As New CDIntf.CDIntf
 
 With PDFPrinter
  ' this adds a new printer named MyPDFPrinter
  .PDFDriverInit "KoeAmyuniPDFTulostin"

  ' set default configuration for all applications
  .PaperWidth = 8413
  .PaperLength = 18933
  .HorizontalMargin = 0
  .VerticalMargin = 0
  .Resolution = 600
  .Orientation = 1
  .SetDefaultConfig

  ' set printer as default
  .SetDefaultPrinter

  ' set default directory for PDF files
  .DefaultDirectory = "d:\"

  ' set default file name
  .DefaultFileName = "d:\testi.pdf"

  ' set options
  .FileNameOptions = NoPrompt + UseFileName

  ' print (this line should be changed according to the target application)
  ' ActiveSheet.PageSetup.PaperSize = xlPaperUser
  ActiveSheet.PrintOut Copies:=1, ActivePrinter:="KoeAmyuniPDFTulostin"
  
  ' reset all options before returning
  .FileNameOptions = 0
  
  .DriverEnd
 End With

 Set PDFPrinter = Nothing ' also removes the PDF printer
That code is almost direct copy-paste from the example code found in the manual of the PDF Converter. It works well when used the very first time after Excel is launched, but after that all the settings I give to Amyuni do not have any effect any more. For example the sheet size is one of the default sizes. When I try to set the sheet size in Excel to xlPaperUser (the commented line before the PrintOut call), I get run-time error 1004 - "Application-defined or object-defined error". Also, the orientation set via PDF Converter does not seem to have any effect. Do I have to do something otherwise, or is this some kind of compatibility problem?


(3) Am I able to plot to custom-sized sheet with an application which requires an paper size to be defined? For example, AutoCAD plot functionality requires a paper size to be defined before plotting something, and because the PDF Converter doesn't display the custom option in the paper size list, I'm forced to select one of the default sizes. How can I get around of this?


I am in a great hurry with this project, so I need detailed information about these problems as soon as possible. How can I fix of bypass these problems, and does upgrading to the current version have any help for me, and if so, how (detailed information, please).


Thanks in advance!

Aleksi
kale
Posts: 6
Joined: Mon Jul 31 2006

Corection

Post by kale »

In the beginning I said, that I was able to print something as big as 5080 mm x 5080 mm. This wasn't true, the maximum length was something like 3100 mm.

Sorry.

Sincerely,
Aleksi
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello Kelly,

Are you really using Amyuni PDF Converter 1.5? This is a very old version that is not supported anymore.

Maybe you are using the latest 2.51, if not please try the latest version.
kale
Posts: 6
Joined: Mon Jul 31 2006

Post by kale »

Thanks for your reply.

I am indeed using the PDF Converter version 1.5. I discussed this matter with my superiors in the company I'm working for, and now I'm evaluating the version 2.51-b to decide if the upgrade is justified considering the functionality we need. Well, at least this version is able to produce a sheet with a size of 5080 mm x 5080 mm without any problems, and you can define custom sheet size in the printer's property dialog. And it shows the Custom option in its sheet size list. However, there are still some problems.


(1) I am not able to test printing capabilities through user interface, because it always tells me that it is not activated (err code -20). Calling EnablePrinter or entering the evaluation licence information through the printer properties dialog do not help at all.


(2) I'm again testing this with Excel 2003 VBA using the following code:

Code: Select all

  Sub PrintToPDF()
  Dim PDFPrinter As New CDIntfEx.CDIntfEx
  Dim strError As String

  With PDFPrinter
    strError = "initializing printer"
    On Error GoTo Err_PrintToPDF

    .PDFDriverInit "AmyuniTestPrinter"
    .EnablePrinter "Evaluation Version Developer Pro",
                   "61C16FEE831...CFF46D3AEDE4CCCC58AEBAFF2A"

    .PaperWidth = 50800
    .PaperLength = 50800
    .HorizontalMargin = 0
    .VerticalMargin = 0
    .Resolution = 600
    .Orientation = 1
    .SetDefaultConfig

    .SetDefaultPrinter

    .DefaultDirectory = "d:\"
    .DefaultFileName = "d:\test.pdf"

    .FileNameOptions = NoPrompt + UseFileName

    With ActiveSheet
      '.PageSetup.PaperSize = xlPaperUser

      strError = "printing the document"
      .PrintOut Copies:=1, ActivePrinter:="AmyuniTestPrinter"
    End With

    .FileNameOptions = 0
    .DriverEnd
  End With
  Set PDFPrinter = Nothing

  Exit Sub


Err_PrintToPDF:
  MsgBox "Error while " + strError + ":" + vbCrLf + vbCrLf + Err.Description, vbExclamation, "Amyuni Test"
End Sub
The problems is the same as before. This code works well when used the very first time after Excel is launched, but after that all the settings I give to Amyuni do not have any effect any more. For example the sheet size is one of the default sizes. When I try to set the sheet size in Excel to xlPaperUser (the commented line before the PrintOut call), I get run-time error saying "Unable to set the PaperSize property of the PageSetup class". Also, the orientation set via PDF Converter does not seem to have any effect. Do I have to do something otherwise, or is this some kind of compatibility problem?


(3) I tried to use this with AutoCAD versions 2004 and 2005, and I was not able to plot anything at all. The PDF Converter again tells that it is not activated, but this time with error code -30, and then AutoCAD tells that the device is not ready. What is the problem here? This beaviour occurs whether I use the plot dialog, plot command or the ActiveX API. The code is the same as above, with the exception of the AutoCAD-specific plot command.


(4) I checked file headers of the files I produced with the PDF Converter and noticed that all of the files follow the PDF specification 1.3. I repeat the same questions I asked before: We would like to know if you have plans to move to PDF 1.6 and implement the scaling capability, and if so, how soon? And if you do that, does it affect to the accuracy of the plotted drawing or are the drawings still able to be presented with an accuracy that equals the one that is currently possible? I just quickly searched through the PDF specification, I don't have time to start to read it through.

Thanks for your help!

Aleksi
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please find here the reply to your various questions:

1 ) If you installed the Developer version of the PDF Converter, it is normal that you will not be able to use it from the user interface or to print to it directly, the Developer version doesn't have any user interface and all the settings and printing should be done programmatically from inside your application.

2) You need to call EnablePrinter() right after PDFDriverInit and right before printing. Please note that when calling PDFDriverInit you are installing a new printer each time you launch your VBA code.

I suggest that you install the PDF Converter on the system using install.exe and use DriverInit to attach to it instead of PDFDriverInit because under Windows 2000, XP, 2003 users need Administrative rights to be able to install printers on their system.

3) This is the same as (1), it is normal not to be able to print directly from Autocad if you installed the Developer version of the PDF Converter, if you wish to print directly from Autocad and other applications you need to install the End User version.

To do this you can reinstall the Demo while checking that 'Developer version' is Unchecked in the installation wizard.

4) Unfortunately i don't have the needed information here. Do you mean scaling capability or layering capability? I suggest that you address this question to support@amyuni.com

Hope this helps.
Last edited by Joan on Tue Aug 08 2006, edited 1 time in total.
kale
Posts: 6
Joined: Mon Jul 31 2006

Post by kale »

Hello!

(1) OK, I tested the Single User version, and it worked fine.

(2) Thanks for pointing these things out. I did what you suggested, and it works faster now. However, the problems I described still exist. What can I do for them?

Code: Select all

Const PC_NO_PROMPT      As Integer = 1
Const PC_USE_FILE_NAME  As Integer = 2

Const PC_LIC_COMPANY    As String = "Evaluation Version Developer Pro"
Const PC_LIC_CODE       As String =
             "61C16FEE831CFF4...6D3AEDE4CCCC58AEBAFF2A"


Sub PrintToPDF()
  Dim PDFPrinter As New CDIntfEx.CDIntfEx
  Dim strError As String

  With PDFPrinter
    strError = "initializing printer"
    On Error GoTo Err_PrintToPDF

    .DriverInit "Amyuni Test Printer"

    .PaperWidth = 50800
    .PaperLength = 20000
    .HorizontalMargin = 0
    .VerticalMargin = 0
    .Resolution = 600
    .Orientation = 1
    .SetDefaultConfig

    .SetDefaultPrinter

    .DefaultDirectory = "d:\"
    .DefaultFileName = "d:\testi.pdf"

    .FileNameOptions = PC_NO_PROMPT + PC_USE_FILE_NAME

    strError = "printing the document"
    'ActiveSheet.PageSetup.PaperSize = xlPaperUser
    .EnablePrinter PC_LIC_COMPANY, PC_LIC_CODE
    ActiveSheet.PrintOut Copies:=1, ActivePrinter:="Amyuni Test Printer"

    .FileNameOptions = 0
    .DriverEnd
  End With
  Set PDFPrinter = Nothing

  Exit Sub


Err_PrintToPDF:
  MsgBox "Error while " + strError + ":" + vbCrLf + vbCrLf + Err.Description, vbExclamation, "Amyuni Test"
End Sub

(3) I don't know why, but first it seemed that I wouldn't be able to plot with AutoCAD's ActiveX interface using the developer version, because it gave me the -30 error, like I described. However, when I tested again today, it worked - partly.

I have problem with PDF Converter's settings. Things go well as long as I use one of the default sheet sizes and specify any plot settings through AutoCAD. Instead, if I want to set a custom sheet size or other settings via PDF Converter, the problem appears. Any settings I specify via PDF Converter do not have any effect. Why this behaviour and how can I fix it?

The AutoLISP code is functionally same as the VBA code before, except the AutoCAD's PlotToDevice method, which is used to plot the document. If there is not a solution for this, it prevents us from using PDF Converter with our software.


(4) Well, currently we aren't under initial product warranty and we don't have a maintenance plan, so I guess they will not tell us anything.


Sincerely,
Aleksi
kale
Posts: 6
Joined: Mon Jul 31 2006

Post by kale »

(4) Sorry, I forgot to add: I mean a capability to scale the user space units described in the PDF 1.6 specification available for download on the Adobe's web site. A scaling factor of 1-75000 can be given to scale the base unit of the user space coordinate system, which makes it possible to have sheet sizes as big as 15000000" x 15000000". The possibility to use this capability to produce PDF's and the possible negative consequences of it (like the loss of accuracy of the content) are the information we are interested about. A value of 3 as the scaling factor would be enough to fulfill our needs.

Best Regards,
Aleksi
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

In reference to your issue #2, I have posted a slightly revised code snippet. I have set the PaperSize() value as custom (255).

Hope this helps?


Dim PDFPrinter As CDIntfEx.CDIntfEx

Sub PrintToPDF()
Set PDFPrinter = New CDIntfEx.CDIntfEx
Dim strError As String

With PDFPrinter
strError = "initializing printer"
On Error GoTo Err_PrintToPDF

.DriverInit "Amyuni PDF Converter"

.PaperSize = 255
.PaperWidth = 50800
.PaperLength = 20000
.HorizontalMargin = 0
.VerticalMargin = 0
.Resolution = 600
.Orientation = 1
.SetDefaultConfig

.SetDefaultPrinter

.DefaultDirectory = "c:\temp"
.DefaultFileName = "c:\temp\testi.pdf"

.FileNameOptions = PC_NO_PROMPT + PC_USE_FILE_NAME

strError = "printing the document"
'ActiveSheet.PageSetup.PaperSize = xlPaperUser
.EnablePrinter PC_LIC_COMPANY, PC_LIC_CODE
ActiveSheet.PrintOut Copies:=1, ActivePrinter:="Amyuni PDF Converter"

.FileNameOptions = 0
.DriverEnd
End With
Set PDFPrinter = Nothing

Exit Sub


Err_PrintToPDF:
MsgBox "Error while " + strError + ":" + vbCrLf + vbCrLf + Err.Description, vbExclamation, "Amyuni Test"
End Sub
kale
Posts: 6
Joined: Mon Jul 31 2006

Post by kale »

Hello Jose, and thanks for your reply.

Unfortunately, the suggested modification does not help at all. The issues I described still exist.

About the paper size value: According to the manual, the value for the custom option is 256, not 255. Also, it is told that the paper size should be automatically changed to the custom option when a value is set to either PaperWidth or PaperLength properties. If the PDF Converter works like described, this modification should be unnecessary. Anyway, I performed tests with both values, but nothing helps.

Is there anything else which could solve these problems?


Sincerely,
Aleksi
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

Oosp, you're right, you should use 256.

I have also created a sample macro using your code snippet and it functions correctly.

I would like to out that the PDF Converter can actually generate a PDF document with a maximum custom paper size of 258 in X 258 in.

However, the resulting PDF document can only be printed and viewed by our PDF Creator product because Adobe Reader has a physical maximum page size of 200 in X 200 in.
aldewacs2
Posts: 6
Joined: Thu Apr 26 2007
Location: CANADA

Autocad Issue / not related but.....

Post by aldewacs2 »

To the originator of this thread: I wonder if you could help me. I can't BatchConvert an AutoCAD drawing (PDF Converter 2.5e) because of the issue described here.

To print to AutoCAD from Windows Explorer: File Type Associations after installation of AutoCAD (R14) yields a BLANK for the “Print” action word.
To get there: IE select a DWG file in explorer –click Tools > Folder Options > File Type > (select DWG file) > shows “open” and “print”, but there is no information at all under “print” when clicking the EDIT button. (it fails to open). I can recreate the "print" data, but need to know what to enter to trick AutoCAD into responding.

Would you know the info for “print” and/or “printto” action word, and would you be kind enough to share the settings with a frustrated soul?

Kind regards,
Aldewacs
Post Reply