Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/DynaPDF Transparency Color Test


Required plugins for this example: MBS DynaPDF Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/DynaPDF Transparency Color Test

This example is the version from Sun, 23th Sep 2017.

Project "DynaPDF Transparency Color Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() dim MyPDF as New MyDynapdfMBS mypdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License Dim TestPicture as New Picture( 128 , 128 , 32 ) // fill with black which will be transparent later TestPicture.Graphics.ForeColor=&c000000 TestPicture.Graphics.FillRect 0,0,TestPicture.Width, TestPicture.Height // draw some red: TestPicture.Graphics.ForeColor=&cFF0000 TestPicture.Graphics.FillRect 30,30,50,50 Dim PDFfolderItem As FolderItem = SpecialFolder.Desktop.Child( "DynaPDF Transparency Color Test.pdf" ) call MyPDF.CreateNewPDF PDFfolderItem call MyPDF.SetDocInfo MyPDF.kdiSubject, "testing transparency color" call MyPDF.SetDocInfo MyPDF.kdiProducer, "Xojo test application" call MyPDF.SetDocInfo MyPDF.kdiTitle, "Why Is the Black Still Here?" call MyPDF.SetPageWidth 256 call MyPDF.SetPageHeight 256 call MyPDF.SetPDFVersion( 3 ) call MyPDF.SetPageLayout( 0 ) call MyPDF.SetPageMode( 0 ) Call MyPDF.SetColorSpace( 0 ) 'RGB call MyPDF.Append // you can uncomment the following line to see the difference: Call MyPDF.SetTransparentColor( &h000000 ) ' black transparent call MyPDF.SetCompressionFilter(MyPDF.kcfFlate) // no compression Call MyPDF.InsertPicture( TestPicture , 64 , 64 , 128 , 128 ) Call MyPDF.SetUseTransparency( FALSE ) call MyPDF.CloseImportFile call MyPDF.EndPage Call MyPDF.CloseFile PDFfolderItem.Launch Quit End EventHandler
End Class
Class Window1 Inherits Window
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyDynaPDFMBS Inherits DynaPDFMBS
EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer // output all messages on the console: System.DebugLog str(ErrorCode)+": "+ErrorMessage // and display dialog: Dim d as New MessageDialog //declare the MessageDialog object Dim b as MessageDialogButton //for handling the result d.icon=MessageDialog.GraphicCaution //display warning icon d.ActionButton.Caption="Continue" d.CancelButton.Visible=True //show the Cancel button // a warning or an error? if BitAnd(ErrorType, me.kE_WARNING) = me.kE_WARNING then // if user decided to ignore, we'll ignore if IgnoreWarnings then Return 0 d.Message="A warning occurred while processing your PDF code." // we add a third button to display all warnings d.AlternateActionButton.Caption = "Ignore warnings" d.AlternateActionButton.Visible = true else d.Message="An error occurred while processing your PDF code." end if d.Explanation = str(ErrorCode)+": "+ErrorMessage b=d.ShowModal //display the dialog Select Case b //determine which button was pressed. Case d.ActionButton Return 0 // ignore Case d.AlternateActionButton IgnoreWarnings = true Return 0 // ignore Case d.CancelButton Return -1 // stop End select End EventHandler
Property IgnoreWarnings As Boolean
End Class
End Project

See also:

The items on this page are in the following plugins: MBS DynaPDF Plugin.


The biggest plugin in space...