DynaPDF has a feature to quickly encrypt or decrypt a PDF with the simplified EncryptPDF and DecryptPDF functions. You need an instance of DynaPDFMBS class and then you can call those methods with the right file reference. Pass in the parameters needed like the user password (for viewing) and the owner password (to remove restriction and encryption). We provide several encryption variants, so you can pick the oldest acceptable one. In our example we use 256 bit AES. Here is an example snippet with two example methods:
Sub DecryptPDF(file as Folderitem)
Dim pdf AsNew DynapdfMBS
pdf.SetLicenseKey "Lite"//ForthisexampleyoucanuseaLite,ProorEnterpriseLicenseCall pdf.DecryptPDF(File, pdf.kptOwner, "ownerpass")
MsgBox "Decrypted."Catch d As DynaPDFErrorExceptionMBS
MsgBox "FailedtodecryptPDF:"+d.message
EndSub
Sub EncryptPDF(file as Folderitem)
Dim pdf AsNew DynapdfMBS
pdf.SetLicenseKey "Lite"//ForthisexampleyoucanuseaLite,ProorEnterpriseLicenseDim flags AsInteger = pdf.krsPrint //forbitprinting
flags = flags Or pdf.krsCopyObj //denycopyingcontent//userpasstojustopenandread//ownerpasstodecryptandremoverestrictionsCall pdf.EncryptPDF(File, "userpass", "ownerpass", pdf.kklAES256, flags)
MsgBox "Encrypted."Catch d As DynaPDFErrorExceptionMBS
MsgBox "FailedtoencryptPDF:"+d.message
EndSub
Please try it, play with the various options on the restrictions. If you make a new PDF with DynaPDF, you can of course also apply the same encryption options for saving the new file. Let us know if you have questions.
Xojo Inc. announced a sale for the next few days:
If you waited to get a Xojo license or to renew your license or to upgrade to Xojo Pro, this is your chance.
As usual, if your Xojo license is up for renewal in August or September, you can update now and enjoy a discount. If your Xojo license expired already, just get a new one. With discount this is cheaper than a regular update.
Conference tickets and add-ons are on sale, too. If you like to get one of the MBS articles there, you can use the sale price at Xojo Store or we match the price if you buy directly from us. Please contact us if you need a MBS Plugin license.
Claris just announced a price increase for all of their products going effective on 24th September 2022. All prices are said to raise by 10%.
While pricing adjustments are often unavoidable, it brings the opportunity to buy at the old prices until 23rd September 2022. So if you have a license of Claris FileMaker, please consider to order updates for adding additional years to it. You may pay for a license 3 or 5 years in advance. Even if your license expired in 2023 or 2024, you may be able to add more time now.
save around 10% by buying now.
save more by ordering multi year licenses.
Also be aware that the around September/October, Claris may be introduce their new pricing for the Claris Studio part of the product. That offer will be more expensive than the existing licenses as the Studio part has an additional cost and you may be able to upgrade.
For MBS Plugin, you can of course also order at current price list and enjoy our multi year offers. Please contact us if you like to order bigger.
For 20 years we used the built-in XML classes in Xojo. While they do the job basically, we had a desire for years to get something better. We now started to make an alternative implementation of XML classes based on the xerces-c project.
Flexibility
By implementing our own classes, we are very flexible on what we support. A lot of utility code we had in various projects to work on xml trees, can now be built-in to the plugin classes and run much faster. Be can also offer more customization on various options.
Unicode support
The new plugin should handle all the unicode details and work well with various text encodings. Usually we use UTF-8 or UTF-16, but we want it to work well with other encodings.
Exceptions
We use exceptions for reporting errors. The exceptions should include all details needed in the message text. As usual our plugin includes for example the index value and the ubound/count value in an OutOfBoundsException.
We like to avoid a couple of common pitfalls, so you can for example freely move nodes between documents. But please avoid recursion in your xml trees.
(more)
For MBS Plugin 12.4 we implemented a long standing wish from various FileMaker developers: Code Folding.
As you know our plugin highlights matching script lines for If and Loop blocks. So you see what lines belongs to what other line. Now when we detect such a block, we add a little control on the between the line number and the text. You can click that control to hide some lines and later click it again to show them.
When you save the script, FileMaker reloads it or you start dragging a line, all lines show again. Our line hiding is only temporary until something unhides them.
Please try and let us know the if you find issues.
As usual, this feature is macOS only. If you like to see a Windows version, please contact Claris Inc. directly to implement this cross platform in a future version.
Some of your clients may have MongoDB databases and your application may need to connect and insert a record. Here is a bit of sample code on how to this:
Sub Action()
//prepareURItoserversDim URI AsNew MongoURIMBS("mongodb://localhost/")
//optionallywithauthentication'URI.UserName="test"'URI.Password="secret"//connectDim client AsNew MongoClientMBS(URI)
//pickdatabaseDim database As MongoDatabaseMBS = client.Database("test")
//pickcollectionDim collection As MongoCollectionMBS = database.Collection("clients")
//nowbuildarecordasJSONDim NewRecord AsNew JSONItem
NewRecord.Value("firstName") = "Bob"
NewRecord.Value("lastName") = "Jones"
NewRecord.Value("city") = "LosAngeles"
NewRecord.Value("phone") = "555-1234-567"//andinsertDim Result AsString = Collection.InsertOne(NewRecord.toString)
Dim j AsNew JSONItem(Result)
Dim n AsInteger = j.Lookup("insertedCount",0)
If n = 1then
MessageBox "Recordsaved"Else
MessageBox "Failedtoinsert:"EndIfException m As MongoExceptionMBS
MessageBox m.message
EndSub
As you see we use our MongoURIMBS class to prepare the connection data like the server URL, port, user name and password. Then we use MongoClientMBS class to establish a connection. We select which database and collection (table) to use and finally insert our record as JSON to it.
Optionally the new InsertMany function in the upcoming 22.4 plugin can be used to insert multiple documents at once. You would pass either a JSON Array with the records or a Xojo array with the JSON objects.
Please try and let us know if it works or whether you have questions.