Jump to content

Recommended Posts

Posted (edited)

Hello Im trying to make a program that can print diferent paper size with different button, the first prints alright but when I choose another type it print a blank small PDF.

This is one of them, the other are aliked but the paper size are different.

 

Func prescribe6x()
;set the properties for the pdf
_SetTitle("Reportes " & $aOkqe26NN3)
_SetSubject("Haga su cita al 809.562.0005")
_SetKeywords("Nutriologa, dietas")

_SetUnit($PDF_UNIT_CM)
_SetPaperSize("CUSTOM",826.7, 1169.3); A4 landscape

_SetZoomMode($PDF_ZOOM_FULLPAGE)
_SetOrientation($PDF_ORIENTATION_PORTRAIT)
_SetLayoutMode($PDF_LAYOUT_CONTINOUS)
_OpenAfter(True);open after generation
;initialize the pdf


$pat19=" " & $dayFF  & "-" & $monFF & "-" & $yeaFF

Local $er=1
 $sFilePathBB=@ScriptDir & "\REPORTES\PRESCRIBE\" & "Pnk " & GUICtrlRead($PACIENTE) & " " & $pat19 & ".pdf"
  $iFileExists = FileExists($sFilePathBB)

    ; Display a message of whether the file exists or not.
Do
    If $iFileExists Then
         $sFilePath=@ScriptDir & "\REPORTES\PRESCRIBE\" & "Pnk " & GUICtrlRead($PACIENTE) & " " & $pat19  & "_" & $er & ".pdf"
         $sFilePath2="Pnk " & $name3 & " " & $sEndDate  & "_" & $er & ".pdf"
         $iFileExists = FileExists($sFilePathBB)
         $er= $er + 1
         $rr=1
      Else
         $rr=0
     EndIf
  Until $rr=0


_InitPDF($sFilePathBB)
;=== load resources used in pdf ===
;images:

_LoadResImage("taietel35BB", @ScriptDir & "\BASEDATOS\pnk.jpg")

;images:

;fonts:
;_LoadFontStandard("_Times", $PDF_FONT_STD_TIMES)
_LoadFontTT("_Arial", $PDF_FONT_ARIAL)
_LoadFontTT("_TimesT", $PDF_FONT_TIMES)
_LoadFontTT("_Calibri", $PDF_FONT_CALIBRI)
_LoadFontTT("_Garamond", $PDF_FONT_GARAMOND)
_LoadFontStandard("_Helv", $PDF_FONT_STD_HELVETICA)
_LoadFontStandard("_Tim", $PDF_FONT_STD_TIMES)
_LoadFontStandard("_Cour", $PDF_FONT_STD_COURIER)
;_LoadFontTT("_Symbol", $PDF_FONT_SYMBOL)

;=== create objects that are used in multiple pages ===
;create a header on all pages, except the first:
_StartObject("AntetBB", $PDF_OBJECT_ALLPAGES);NOTFIRSTPAGE)
    ;insert a image already loaded
    _InsertImage("taietel35BB", 0, 0, _GetPageWidth()/_GetUnit(), _GetPageHeight()/_GetUnit())

_EndObject()


;start a page
_BeginPage(0)
    ;put some graphics, text etc (see the rest)


 ;text

 _SetColourFill(0x000000)
_DrawText(2.7, 33.19, $dayFF, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
 _SetColourFill(0x000000)
_DrawText(4.2, 33.19, $monFF, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
 _SetColourFill(0x000000)
_DrawText(5.4, 33.19, $yeaFF, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 _SetColourFill(0x000000)
_DrawText(5, 30.39, StringUpper(GUICtrlRead($PACIENTE)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

IF GUICtrlRead($PRIM1 )=1 Then
_SetColourFill(0x000000)
_DrawText(18.25, 33.09, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
 IF GUICtrlRead($PRIM2 )=1 Then
_SetColourFill(0x000000)
_DrawText(19.18, 33.09, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

 IF GUICtrlRead($SEMF )=1 Then
_SetColourFill(0x000000)
_DrawText(20, 30.32, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
IF GUICtrlRead($SEXM )=1 Then
_SetColourFill(0x000000)
_DrawText(20.9, 30.32, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

_SetColourFill(0x000000)
_DrawText(23.3, 30.39, StringUpper(GUICtrlRead($EDADX)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(26.5, 30.39, StringUpper(GUICtrlRead($TALLAX)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 _SetColourFill(0x000000)
_DrawText(6.5, 29.44, $dayFF6, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
 _SetColourFill(0x000000)
_DrawText(7.8, 29.44, $monFF6, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
 _SetColourFill(0x000000)
_DrawText(9.1, 29.44, $yeaFF6, "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(13.55, 29.44, StringUpper(GUICtrlRead($PESOA)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(19.85, 29.44, StringUpper(GUICtrlRead($CINTUR)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(5.9, 25.04, StringUpper(GUICtrlRead($metodop)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

IF GUICtrlRead($PAS1 )=1 Then
_SetColourFill(0x000000)
_DrawText(15.75, 25.04, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
 IF GUICtrlRead($PAS2 )=1 Then
_SetColourFill(0x000000)
_DrawText(16.85, 25.04, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
_SetColourFill(0x000000)
_DrawText(6.4, 17.09, StringUpper(GUICtrlRead($PASO1T)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(6.4, 16.14, StringUpper(GUICtrlRead($PASO1D)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

_SetColourFill(0x000000)
_DrawText(9.7, 17.09, StringUpper(GUICtrlRead($PASO2T)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(9.7, 16.14, StringUpper(GUICtrlRead($PASO2D)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

_SetColourFill(0x000000)
_DrawText(12.8, 17.09, StringUpper(GUICtrlRead($PASO3T)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(12.8, 16.14, StringUpper(GUICtrlRead($PASO3D)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

_SetColourFill(0x000000)
_DrawText(16.1, 17.09, StringUpper(GUICtrlRead($PASO4T)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(16.1, 16.14, StringUpper(GUICtrlRead($PASO4D)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

_SetColourFill(0x000000)
_DrawText(19.3, 17.09, StringUpper(GUICtrlRead($PASO5T)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
_SetColourFill(0x000000)
_DrawText(19.3, 16.14, StringUpper(GUICtrlRead($PASO5D)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 IF GUICtrlRead($VITA )=1 Then
_SetColourFill(0x000000)
_DrawText(2.3, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

  IF GUICtrlRead($SODI )=1 Then
_SetColourFill(0x000000)
_DrawText(4.6, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

  IF GUICtrlRead($POTAS )=1 Then
_SetColourFill(0x000000)
_DrawText(6.4, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

  IF GUICtrlRead($CALC )=1 Then
_SetColourFill(0x000000)
_DrawText(8.4, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf

  IF GUICtrlRead($MAGNE )=1 Then
_SetColourFill(0x000000)
_DrawText(10.2, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
  IF GUICtrlRead($OMEG )=1 Then
_SetColourFill(0x000000)
_DrawText(12.55, 15.34, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
 _SetColourFill(0x000000)
_DrawText(10.2, 14.64, StringUpper(GUICtrlRead($OBSERV)), "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)
  IF GUICtrlRead($PROG1 )=1 Then
_SetColourFill(0x000000)
_DrawText(12.5, 13.76, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf
   IF GUICtrlRead($PROG2 )=1 Then
_SetColourFill(0x000000)
_DrawText(13.5, 13.76, "X", "_Helv", 14, $PDF_ALIGN_LEFT, 0)
_SetColourFill(0)

 EndIf


_EndPage()

;then, finally, write the buffer to disk
_ClosePDFFile()
   $_Buffer = "" ;~ Reset Buffer
    $_Images = "" ;~ Reset Resource Images
    $_Pages = 0 ;~ Reset Pages to 0


EndFunc

 

Edited by JLogan3o13
Posted
4 minutes ago, JLogan3o13 said:

@trucu Please use the code formatting function (<> in your toolbar) when posting code. Makes things so much easier to read.

ok thanks first time I post anything, didnt know how to do it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...