Ce code montre comment créer un fichier PDF grâce à la librairie SFPDF que je développe également. C'est une version qui possède les fonctions de bases. Je poserai un peu plus tard une nouvelle librairie permettant de faire des trucs beaucoup plus fun avec le PDF.
Cette librairie à l'avantage d'être totalement indépendante.
Source / Exemple :
// ZIP
Conclusion :
Si jamais vous rencontrez des bugs n'hésitez pas à me le faire remonter. Cette librarie est encore en test et est sujet à plein de modification.
2 nov. 2009 à 16:33
2 nov. 2009 à 15:00
12 juin 2008 à 12:31
12 juin 2008 à 11:42
Public Type SFPDFPOS
dwX As Long
dwY As Long
dwW As Long
dwH As Long
dNewPage As Long
End Type
Public Declare Sub SFPDF_Init Lib "SFPDF.dll" (ByVal dwOrientation As Long)
Public Declare Function SFPDF_AddPage Lib "SFPDF.dll" () As Long
Public Declare Function SFPDF_Output Lib "SFPDF.dll" (ByVal FileName As String) As Long
Public Declare Function SFPDF_Cell Lib "SFPDF.dll" (ByVal dwX As Double, ByVal dwY As Double, ByVal dwW As Double, ByVal dwH As Double, ByVal dwL As Long, ByVal dwR As Long, ByVal dwT As Long, ByVal dwB As Long, ByVal dwFill As Long, ByVal dwAlign As Long, ByVal sTxt As String) As Long
Public Declare Function SFPDF_DrawColor Lib "SFPDF.dll" (ByVal dwR As Long, ByVal dwG As Long, ByVal dwB As Long) As Long
Public Declare Function SFPDF_DrawLine Lib "SFPDF.dll" (ByVal dwX1 As Long, ByVal dwY1 As Long, ByVal dwX2 As Long, ByVal dwY2 As Long) As Long
Public Declare Function SFPDF_FillColor Lib "SFPDF.dll" (ByVal dwR As Long, ByVal dwG As Long, ByVal dwB As Long) As Long
Public Declare Function SFPDF_GetHauteur Lib "SFPDF.dll" () As Long
Public Declare Function SFPDF_GetLargeur Lib "SFPDF.dll" () As Long
Public Declare Function SFPDF_Image Lib "SFPDF.dll" (ByVal FileName As String, ByVal dwX As Long, ByVal dwY As Long, ByVal dwW As Long, ByVal dwH As Long) As Long
Public Declare Function SFPDF_LineWidth Lib "SFPDF.dll" (ByVal dWidth As Double) As Long
Public Declare Function SFPDF_SetFont Lib "SFPDF.dll" (ByVal PoliceName As String, ByVal dwSize As Long) As Long
Public Declare Sub SFPDF_SetFontSize Lib "SFPDF.dll" (ByVal dwSize As Long)
Public Declare Function SFPDF_Text Lib "SFPDF.dll" (ByVal dwX As Long, ByVal dwY As Long, ByVal Texte As String) As Long
Public Declare Function SFPDF_TextColor Lib "SFPDF.dll" (ByVal dwR As Long, ByVal dwG As Long, ByVal dwB As Long) As Long
Public Declare Function SFPDF_TextFlow Lib "SFPDF.dll" (ByVal dwX As Long, ByVal dwY As Long, ByVal dwW As Long, ByVal dwH As Long, ByVal dwAlign As Long, ByVal Texte As String) As Long
Public Declare Sub SFPDF_SetBreakPageCallback Lib "SFPDF.dll" (ByVal dwAddr As Long)
Public Declare Function SFPDF_GetLargeurTexte Lib "SFPDF.dll" (ByVal Texte As String) As Double
12 juin 2008 à 09:56
Private Declare Function SFPDF_AddPage Lib "sfpdf.dll" Alias "SFPDF_AddPage" () As UInteger
Private Declare Function SFPDF_Cell Lib "sfpdf.dll" Alias "SFPDF_Cell" (ByVal dwX As Double, ByVal dwY As Double, ByVal dwW As Double, ByVal dwH As Double, ByVal dwL As UInteger, ByVal dwR As UInteger, ByVal dwT As UInteger, ByVal dwB As UInteger, ByVal dwFill As UInteger, ByVal dwAlign As UInteger, ByVal szTxt As System.IntPtr) As UInteger
Private Declare Function SFPDF_DrawColor Lib "sfpdf.dll" Alias "SFPDF_DrawColor" (ByVal dwR As UInteger, ByVal dwG As UInteger, ByVal dwB As UInteger) As UInteger
Private Declare Function SFPDF_DrawLine Lib "sfpdf.dll" Alias "SFPDF_DrawLine" (ByVal dwX1 As UInteger, ByVal dwY1 As UInteger, ByVal dwX2 As UInteger, ByVal dwY2 As UInteger) As UInteger
Private Declare Function SFPDF_FillColor Lib "sfpdf.dll" Alias "SFPDF_FillColor" (ByVal dwR As UInteger, ByVal dwG As UInteger, ByVal dwB As UInteger) As UInteger
Private Declare Function SFPDF_GetHauteur Lib "sfpdf.dll" Alias "SFPDF_GetHauteur" () As UInteger
Private Declare Function SFPDF_GetLargeur Lib "sfpdf.dll" Alias "SFPDF_GetLargeur" () As UInteger
Private Declare Function SFPDF_Image Lib "sfpdf.dll" Alias "SFPDF_Image" (ByVal szFile As System.IntPtr, ByVal dwX As UInteger, ByVal dwY As UInteger, ByVal dwW As UInteger, ByVal dwH As UInteger) As UInteger
Private Declare Function SFPDF_Init Lib "sfpdf.dll" Alias "SFPDF_Init" (ByVal dwOrientation As UInteger)
Private Declare Function SFPDF_LineWidth Lib "sfpdf.dll" Alias "SFPDF_LineWidth" (ByVal dWidth As Double) As UInteger
Private Declare Function SFPDF_Output Lib "sfpdf.dll" Alias "SFPDF_Output" (ByVal szFile As System.IntPtr) As UInteger
Private Declare Function SFPDF_SetFont Lib "sfpdf.dll" Alias "SFPDF_SetFont" (ByVal szPolice As System.IntPtr, ByVal dwSize As UInteger) As UInteger
Private Declare Function SFPDF_SetFontSize Lib "sfpdf.dll" Alias "SFPDF_SetFontSize" (ByVal dwSize As UInteger)
Private Declare Function SFPDF_Text Lib "sfpdf.dll" Alias "SFPDF_Text" (ByVal dwX As Integer, ByVal dwY As Integer, ByVal szTxt As System.IntPtr) As UInteger
Private Declare Function SFPDF_TextColor Lib "sfpdf.dll" Alias "SFPDF_TextColor" (ByVal dwR As UInteger, ByVal dwG As UInteger, ByVal dwB As UInteger) As UInteger
Private Declare Function SFPDF_TextFlow Lib "sfpdf.dll" Alias "SFPDF_TextFlow" (ByVal dwX As Integer, ByVal dwY As Integer, ByVal dwW As UInteger, ByVal dwH As UInteger, ByVal dwAlign As UInteger, ByVal szTxt As System.IntPtr) As UInteger
Private Declare Function SFPDF_SetBreakPageCallback Lib "sfpdf.dll" Alias "SFPDF_SetBreakPageCallback" (ByVal dwAddr As UInteger)
Private Declare Function SFPDF_GetLargeurTexte Lib "sfpdf.dll" Alias "SFPDF_GetLargeurTexte" (ByVal szTxt As System.IntPtr) As Double
Public Structure SFPDFPOS
'''DWORD->unsigned int
Public dwX As UInteger
'''DWORD->unsigned int
Public dwY As UInteger
'''DWORD->unsigned int
Public dwW As UInteger
'''DWORD->unsigned int
Public dwH As UInteger
'''DWORD->unsigned int
Public dNewPage As UInteger
End Structure
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.