How to Upload PHP Project to Heroku? – Advanced Steps

In the previous article, we learned how to create a new PHP project on Heroku. But sometimes our project requires additional extensions that do not exist in the Heroku PHP configuration. So we need to find out how to create and install extensions for PHP on Heroku.

In this post, I'll show you these advanced steps, and create a PHP project on Heroku with the GroupDocs PHP SDK Api Samples application.

Preparation

All required preparation are described in previous article. Also, we need two PHP extensions such as Curl and Sockets that are used in our PHP Samples application.

Build an extension on Heroku.

This can be done by opening a Heroku console, download the PHP source-code and compile the extension, then copying it over.

To create the Curl extension:

  1. Open console and cd to root folder of your API.
  2. >heroku run bash heroku run bash How to Upload PHP Project to Heroku?   Advanced Steps
  3. $ mkdir tmp
  4. $cd tmp
  5. git clonehttps://github.com/php/php-src.git git clonehttps How to Upload PHP Project to Heroku?   Advanced Steps
  6. $cd php-src
  7. $ cd ext/curl
  8. $ /app/php/bin/phpize phpize How to Upload PHP Project to Heroku?   Advanced Steps
  9. $ ./configure --with-php-config=/app/php/bin/php-config Configure How to Upload PHP Project to Heroku?   Advanced Steps
  10. $ make
  11. $ cd modules

To create the Sockets extension, take the same steps.

Don't close the console. We will use it for the next steps.

Download lib from Heroku.

Now we have compiled the extension, but this file is on the Heroku server and we need it in our API.

To get the file from the server and add it to the API, we can create an empty repo on GitHub and clone it to the temp folder in which we compile the extension. Then copy the extension file and push it to GitHub. After that, you can download it from GitHub to the lib folder and push it to Heroku.

Lets see this logic in practical steps by adding the Curl extension:

  1. In the mudel folder, $ ssh-keygen -t rsa
  2. $ cat /app/.ssh/id_rsa.pub
    This command shows your ssh key file content in the console. Copy it.
  3. Add your SSH key to GitHub.
  4. $ git clone yourreposshurl
  5. $ mv curl.so cloned folder name
  6. $ cd cloned folder
  7. $ git add .
  8. $ git commit -m "adding extension"
  9. $ git push origin master
  10. $ exit

Now we have our extension file in the GitHub repository and we can download it.

To add the Sockets extension, take the same steps.

Add lib and php.ini file to your app and upload them to Heroku

In the root folder of the API, create a lib folder and save the downloaded file there. And there's only one thing left to do: create a php.ini file in the root folder of the API that points to that extension. The changes are committed. To do all this open console and:

  1. cd to the API root folder
  2. >mkdir lib
  3. cd to the folder where the downloaded extension folder is.
  4. >mv curl.so rootfolderapi/lib
  5. cd to the API root folder.
  6. $ echo extension = /app/www/lib/curl.so > php.ini
  7. $ git add .
  8. $ git commit -m "adding extension"
  9. $ git push origin master

That's all, your new PHP application is ready to use on Heroku. Enjoy!

Signing Off,

The GroupDocs Marketplace Team

How to upload PHP project to Heroku?

Heroku is a great opportunity for developers to try and test their code in a production environment. Originally created for Ruby projects, Heroku now supports Ruby, Java, Python and even PHP. Heroku's PHP project support is an undocumented feature so some additional skills are required do deploy such a project.

In this post, I'll show you the methods to create a PHP project on Heroku with the GroupDocs PHP SDK Api Samples application.

Preparation

  • To get the PHP samples, you first need to clone the entire PHP SDK repository:
    $ git clone git://github.com/groupdocs/groupdocs-php.git
  • Then go to the examples directory ($ cd groupdocs-php/examples) and copy the api-samples folder to the location where you want to create a Heroku project.

Note: Before uploading PHP API samples to Heroku, you need to update the PHP SDK in the API Samples project. You can check out our previous posts to find information on how to do this, for example, How to use GroupDocs PHP SDK with Composer or a Built-in Autoloader.

Creating a Heroku project

To create a Heroku project, create a local repository with git (the example below assumes that you have Heroku toolbelt installed).

Note that in some guides, you might see the option -stack cedar in the heroku create command. This option is not required anymore. -stack cedar is now the default for new apps on Heroku.

If you've done everything correctly, Heroku creates a new application and adds a new remote (with the same name – heroku) to your local repository. You can check this with the command:
$ git remote --v

You should see Heroku remote records with remote URLs for pull and push.

Now you can push your local repository to Heroku:

All your commits from the local repository are pushed to Heroku. Heroku detects the type of your application – PHP project in our case – and starts the appropriate server to host the app.

If you use only standard PHP libraries, you can immediately start working with your new application on Heroku:

But if your project/app requires a non-standard library (like the PHP API samples project), then you'll have problems with Heroku if you try to use it immediately. To be able to use such extensions, you need to perform additional steps:

  1. Build an extension on Heroku.
  2. Download lib from Heroku.
  3. Add lib and php.ini file to your app and upload them to Heroku.

I'll show you how to perform those advanced steps in the next blog post.

 

Signing Off,

The GroupDocs Marketplace Team

GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

GroupDocs extended the reach of its powerful Comparison app to a whole host of CMSs last month, in addition to enhancing its app UIs.

May is an exciting month for GroupDocs as we're about to launch GroupDocs Viewer for .NET, a downloadable version of our online document viewer for the .NET platform. This lets you use GroupDocs Viewer as part of your .NET systems.

Tabular data merging in Assembly and a pressure-sensitive signing pad for GroupDocs Signature are in the offing. In addition, you can expect more enhancements to all of our app UIs in the coming weeks.

New Features GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

This month, we've made enhancements to several GroupDocs apps, launched various plugins for CMSs and updated the GroupDocs SDKs.

GD Viewer image GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • Usability enhancements.

GS Annotation heading image GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • Cursor based real-time pointer improvements.

GD Assembly image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • WYSIWYG support for questionnaire answers and enhanced integration options.

GD Comparison image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • Addition of embedded comparison results.
  • Roll-out of Comparison v2.0 with results summary list.

GD Signature image GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • Embedded signature enhancements to support automatically adding fields to positions within documents.
GD Dashboard image GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET
  • New document post-upload progress indicator.
  • Various optimizations to improve usability.
GD API image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

GD Comparison Integration image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

SDK API Sample Updates GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

Coming Soon GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

Expect these exciting features soon:

GD Viewer image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • GroupDocs Viewer for .NET - Install GroupDocs Viewer as part of your platform and .NET apps.
  • GroupDocs Viewer plugin for FireFox.
  • GroupDocs Viewer plugin for Google Chrome.

GD Assembly image2 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • GroupDocs Assembly v2.0 - Support for merging tabular data.
  • GroupDocs Assembly v2.0 - Enhanced and streamlined UI.

GD Signature image1 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • GroupDocs Signature v2.0 - New high-fidelity pressure-sensitive signing pad and improved UI.
  • Publish Signature plugin for Moodle.
  • Publish Signature plugin for CMSMS.
  • GroupDocs Signature plugin for Gmail (Chrome).

GD Comparison image2 GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

  • GroupDocs Comparison v2.0 - Improved UI.

Featured Blogpost GroupDocs Newsletter May 2013: GroupDocs Comparison CMS Integration and GroupDocs Viewer for .NET

Following are some of the popular blog posts in the month of March:

Thank you for choosing GroupDocs.

The GroupDocs Team

How to merge data fields from a DOCX file with a data source and output to PDF

This article explains how to get the fields from a template DOCX file, fill them with data and merge to new PDF file using GroupDocs.

Requirements

We already know how to install the Fatfree framework and prepare for creating the sample from the previous article. The sample that we create in this article is not much different from other sample with Fatfree. We need a template file with a form and a controller file to process entered data.

Sample creation

The template file is the same as in the previous article. Because of this, I will not explain the template file but just show the code.

Template file code

OK, what's happening with the template file clear so lets take a look at the controller file.

Controller file

We already know how to create this file. If you're unsure, look at a previous post that explains how.

Below, I'll show you the complete controller code and then explain how it works.

That's the controller: open your mind and plunge in.

First of all, we get all the data transfered from the form by POST to the controller. This block of code does that:

As you can see, we use the Fatfree method F3::set to initially set the template variables and then the F3::get method to get the posted data. We have all necessary data to create API objects; the rest of the data we will get later.

Let's create a function that takes this data, checks it and does the rest of the magic. The function is called mergeFields and a definition looks like this: function mergeFields($clientId, $privateKey). The mergeFields function takes two parameters - client ID and private key. This data is most important because without it, we can't send a request to the API. That's why we check that it's been entered with this code:

Then, if the client ID and private key have been entered we proceed with API objects creation. I expect you already know how to do this.

Next, we check whether the user wants to upload a local file, one from the web, or a file already in the GroupDocs account. We can work with documents through the file GUID. We dont have this data, but that's not a problem - lets get it. Simply use the Fatfree method F3::get to get the client ID and private key.

Get the rest of the data:

Since this data are simple strings - with the exception of $file - check which of them are chosen by elementary verification on an empty string: if ($url != "") or if ($fileId != "").

If you wonder what to do if a user selects to upload a local file, how to check it. It's not a problem. In the global variable which consist of the local file we have an array of file data such as file name, temp name and file content. To check if a user has selected a local file, simply check if the file name is empty. This array field consist of string data and we can check it for empty string: if ($_FILES['file']["name"] != "").

According to which check returns "true", we know whether to use an entered file GUID or upload a file in three different ways. How to do this you can read in last weeks post: Two ways to upload files.

The most interesting part, and culmination of this example, is to get the field from template DOCX file and merge them to a PDF file. To do this, we need this GroupDocs PHP SDK methods:

  •  From DocApi GetTemplateFields
  • From MergeApi AddDataSource and MergeDatasource
  • From AsyncApi GetJobDocuments
  • And from StorageApi GetFile

First, let's take a look at the code which will do all this work and use our methods:

The logic is simple.

  • First, we get all the fields from the template DOCX file with the GetTemplateFields method. It takes the parameters client ID and template DOCX file GUID. The method returns an object with fields.
  • Now, create a DataSource object in which one of the parameters is a DataSourceFields array which we must create. We will put the field we get from template DOCX file into this array. This action occurs in this peace of code:

As you can see, the DataSourceFields object has a values parameter. Into this parameter we put an array of strings or only string which will be added to the field as content.

  • After creating the DataSource object, the next step is to add DataSource to GroupDocs for the convertion to PDF. This trick can be done as follows:

In response to this we get the datasource ID by which we can both merge it and convert to PDF, thus killing two birds with one stone.

  •  Take the client ID, datasource ID, the original DOCX file GUID and put all of this into the MergeDatasource method. This request in code:

As you see, one of the input parameters is a string with type of the result file. When the API gets this request, it creates a new PDF file with merged fields.

Phew, we merged our fields to a new PDF file and now we can download it and see it in an iframe. The MergeDatasource method returns Job id using which in the GetJobDocuments method we get all the info about the new PDF file that we need, such is GUID and name.

  • To download it, create a FileStream which contains a local path for downloading the file:

After that use the GetFile method to download it: $download = $apiStorage->GetFile($clientId, $guid, $outFileStream);

You already know how to generate an iframe.

The only thing left is to call our function and return the new PDF file GUID to the template to show in the browser as an iframe. You already know how to do this too, if you've followed this article series.

And we're done!

Screenshots

Here are two screenshots that show the input form and the output file so you can see the process in action.

The input form

form How to merge data fields from a DOCX file with a data source and output to PDF

The output PDF

iframe How to merge data fields from a DOCX file with a data source and output to PDF

Two ways of uploading files into a GroupDocs account

Working with GroupDocs SDK we usually need a GUID to work with a document. But it's not very comfortable for users to work with GUIDs. So in your app, you can use two methods to upload a file to a GroupDocs account and get it's GUID programmatically.

Requirements

We already know how to install the Fatfree framework and prepare for creating the sample from the previous article. So lets start with the magic.

Theory

Upload local file

To upload a local file we need an actual file. You can view many types to word processing documents (DOC, DOCX, TXT, RTF, ODT), presentations (PPT, PPTX), spreadsheets (XLS, XLSX), portable files (PDF), and image files (JPG, BMP, GIF, TIFF).

From GroupDocs PHP SDK we will need the following methods:

  • Upload
  • FileStream::fromFile

The template is simply an HTML form of the "multipart/form-data" type. This form sends date entered by the user (the client ID, private key and local file data) to the controller. The controller, in turn, gets the data, prepares it for an API request, makes the API request and receives the upload results from the API with info about the uploaded file.

Upload file from web

If you think this is going to be complicated, I have to disappoint you. With GroupDocs PHP SDK it's really simple than upload a local file.

To upload a file from the web, we need a direct link to the file. Everything else is the same as when uploading a local file, with the exception of the upload method. To do this trick we need only one method: uploadWeb. The logic of web uploading is the same as for local file upload.

Since the logic is the same we'll use same template and controller.

Practice

As before, create a template file in the template folder and a controller file in the inc_samples folder.

Template file code

Let's investigate this code. This is a simple HTML document with JavaScript. To select the file source (local or web) we've added a switch:

This switch calls the JavaScript function display. This function receives one parameter which specifies the source of the file: local or web. Where local = upload local file and url = upload file from web. Toggling the switch displays the corresponding input field.

OK, it's clear how the template works - it's simple enough. Let's take a look at the controller.

Controller code

Now let's analyze the blocks of code we have here.

In this block we get the data from the form transfered by the POST method with the Fatfree method F3::get which gives access to the global arrays such as POST, GET, FILE and SERVER. When we have collected the entered data, we can create a function which will do the job and we will have the ability to check every steps and get errors if there are any. Our function will get four parameters: client ID, private key, width and height (we need width and height for the iframe that will show the uploaded file).

First of all, we must check whether the client ID and private key are entered. Without this data we can't do anything. Check it with this code:

If we have this data, we can proceed to the next code block:

Here we set user data for template and get the rest of the entered data from the form, such as the URL of a web file and the location of the local file. Later, we will check which fields are chosen by this data. Now we must create objects which will set up the relationships with the GroupDocs API and user account. This code does that:

So we can check from where we're about to upload the file and then upload it. To check if the user choose to upload a file from the web, and to upload the file, use this code:

This block does all the magic uploading a file from the web. As you can see we check whether $url is an empty string. If it is not empty, the user has selected to upload a file from the web and we use the URL. To upload the file, we make a request to the UploadWeb method with the client ID and the URL for the file:

Thats all for web uploading. Simple, yes?

OK in response to this method we have an object with an array of all the info for this file such as the GUID, name, type and so on. To show this file in an iframe, we only need the GUID. We can get GUID easily:

If uploadWeb fails we get an error message:

But what if the user wants to upload a local file? We can check if they do, and if so upload the local file with this code:

To upload a local file we must get its name, assign it a temporary name and convert it to a FileStream. The first two we can get as usual for multipart/form-data:

And to convert the file to FileStream in the GroupDocs PHP SDK we have very cool thing: FileStream::fromFile. This function gets the file's temp name and returns a FileStream. Now we can send request to the GroupDocs API to upload the local file. The Upload file method get such parameters as client ID, local file name, description(string), callback URL (in this sample we'll use an empty string but if you want to, you can specify it) and FileStream. In the response object for the UploadWeb method we get info about the uploaded file. If the request failed, we get an error message.

Displaying the file

We've finished the upload and now we have only to generate an iframe and call our function.

 

The code in action

Thats all. Below are a couple of screenshots that show how it looks in action.

The input form

form1 Two ways of uploading files into a GroupDocs account

 

The iframe showing the uploaded document

iframe2 Two ways of uploading files into a GroupDocs account

 

GroupDocs Apps v2.4 – Features and Fixes

We’ve implemented a few new features as well as fixed some major & minor bugs lately. Let’s have a detailed look:

GroupDocs Annotation

GroupDocs Annotation is an online document annotation app that lets you easily annotate documents and perform document collaboration simply using your browser. Using GroupDocs’ efficient document annotation app, you can annotate and collaborate on Word, PDF, or Excel documents, just to name a few.

Features Implemented

  • Major
    • [ANNOTATION-232] Broadcast of horizontal scroll, broadcast of window size percentage when scaling, and support for master and slaves in real-time mode.

Bugs fixed

  • Critical:
    • [ANNOTATION-220] If a user is registered as a reviewer for multiple documents, he will receive all broadcasted operations into each open document.
    • [ANNOTATION-226] Export "Normal" raises an error.
    • [ANNOTATION-230] Downloading an annotated document by using a direct file link fails.
  • Major:
    • [ANNOTATION-225] The background color of the pages and thumbnails is transparent, which creates flashes when they are being loaded.
    • [ANNOTATION-228] Annotation v.2. The document should expand when the RHS toolbar is collapsed.
    • [ANNOTATION-223] Annotation v.2. An iPhone-styled button for switching between broadcast and screen drag, disable pinch to shrink and pullout to magnify, and a setting for removing the toolbar completely.
    • [ANNOTATION-222] Annotation 2. Search doesn't find the searched text.
  • Minor
    • [ANNOTATION-224] Text selection is shifted 1 pixel to the right and 1-2 pixels up from the correct position.
    • [ANNOTATION-227] The "standard header is always shown" option.

GroupDocs Viewer

GroupDocs Viewer is an efficient online document viewer that lets you view documents online simply using a browser. Since GroupDocs Viewer supports all common and business file formats, it can be used as a PDF viewer, Word viewer, Excel viewer, amongst many others.

Features Implemented

  • Major
    • [WEB-346] Client side code for the installable Viewer.
    • [WEB-347] JavaScript-based NavigationWidget.
    • [WEB-348] JavaScript-based ZoomingWidget.
    • [WEB-351] Installable Viewer: JS document viewer adapter without user ID / private key dependencies, working when some widgets are disabled.
  • Minor
    • [WEB-342] Update document viewer 1.0 header.
    • [WEB-352] The PortalService for the installable Viewer.

Bugs fixed

  • Minor
    • [WEB-343] Document print doesn't work in the embedded viewer.

GroupDocs Assembly

GroupDocs Assembly is an efficient document automation and document assembly app that lets you perform document assembly in a jiffy. With GroupDocs Assembly, you can prepare a document for document assembly by adding questionnaires to it and then send out this document to collect responses. Your customers can then add answers to the questionnaires and perform document assembly easily. Document automation and document assembly using GroupDocs Assembly lets you save your time and effort.

Features Implemented

  • Major
    • [DA-144] WYSIWYG support for questionnaire answers.
    • [DA-148] Web hook for the document assembly job.

Bugs fixed

  • Major:
    • [DA-145] Long questions and answers word-wrap.

GroupDocs Signature

GroupDocs Signature is an efficient digital signature service, which is completely web-based. GroupDocs' easy-to-use digital signature service lets you collect digital signatures with no administrative overhead of printing, envelope stuffing and posting.

Features Implemented

  • [SIGN-967] - Signature2: Signed view for envelopes.
  • [SIGN-968] - Signature 2: Signed embedded view for envelopes.

Improvements

  • [SIGN-942] - Signature 2: New status icons for envelopes and forms.
  • [SIGN-949] - Implement async signing of the signature envelopes.
  • [SIGN-950] - Adopt signed screen and signed embedded screen to work with async envelope signing process.
  • [SIGN-956] - Signature 2: Implement envelope-embed signing.
  • [SIGN-957] - Signature 2: Improve the user experience after clicking "New Envelope" in the envelopes dashboard.
  • [SIGN-961] - Signature 2: Improve the user experience after clicking "New Form" in the forms dashboard.
  • [SIGN-980] - Implement changes in envelope.create and envelope.modify
  • [SIGN-981] - New settings while preparing envelope in signature 1 and signature 2.
  • [SIGN-983] - Signature 2: Implement embed signed screen.
  • [SIGN-995] - Implement create envelope from envelope in signature 1 and signature 2.
  • [SIGN-999] - Increase recipient name's length for envelopes.
  • [SIGN-1005] - Default value for "Include embed link .." settings for envelope should be true.
  • [SIGN-940] - Signature 2: Implement template preparation wizard.
  • [SIGN-969] - Signature 2: Forms: recheck that the forms signing is working and apply fixes if not.
  • [SIGN-998] - Display error messages in embedded signature as a popup.
  • [SIGN-1014] - Signatrure 1: From archived envelopes, the user should be able to copy the envelope and start over.
  • [SIGN-1015] - Signature 1: Ensure that recipients with role CC are not included in the recipients' dropdown list in fields preparation.
  • [SIGN-1016] - Signature 1: For CC recipients, show the embed link button in envelopes dashboard only when envelope is completed.
  • [SIGN-1018] - Signature 1: Do not show embed link button in envelopes dash board for envelopes with status expired and draft.
  • [SIGN-1019] - Signature 1: In forms dashboard, add Publish Form in the context menu for draft forms.
  • [SIGN-1027] - Signature 2: Envelopes: Do not show fields summary on step 6 in envelope preparation wizard.

Bugs fixed

  • [SIGN-853] When envelope is signed from the embeddable view, the notification to callback url is not sent.
  • [SIGN-919] - Demo performance.
  • [SIGN-927] - Signature 2: Envelopes dashboard, and statuses overlaps the envelope name.
  • [SIGN-935] - Forms: Form preparation wizard, fields settings: remove all jquery selectors.
  • [SIGN-944] - Signature 2: Envelopes dashboard, the paging on scrolling does not work properly.
  • [SIGN-945] - Fix template.recipient.add and template.recipient api methods response.
  • [SIGN-946] - Sign embed requires login.
  • [SIGN-947] - Demo signature on send envelope shows error message.
  • [SIGN-951] - Create public API method to retrieve envelope details.
  • [SIGN-952] - Fix the signatureEnvelopeDetails widget to use public API method if the viewing mode is public.
  • [SIGN-953] - Clear the signed document thumbnails, so the most recent pages to be shown in the viewer.
  • [SIGN-954] - Signature 2: In the sign envelope screen, in the signature creation popup, the font for written signature are not initialized correctly.
  • [SIGN-955] - Signature 2: If we close the signature popup with ESC key, it can't be shown anymore.
  • [SIGN-962] - Signature 2: If archived forms list is empty, the select all checkbox is selected.
  • [SIGN-963] - AddContactIntegration raises error.
  • [SIGN-964] - Add drop-down field doesn't set acceptableValues and defaultValue.
  • [SIGN-966] - Inconsistency in signature API boolean parameters.
  • [SIGN-970] - Comparing word files with revisions information in them is failing.
  • [SIGN-971] - Cannot add two files with the same name, but different extension to envelope.
  • [SIGN-972] - If there is drop-down field without list with values, the envelope should not be able to be send.
  • [SIGN-973] - If there is a drop-down field without list with values, the form should not be able to be published
  • [SIGN-974] - Drop-down value is reset to the default value on reload even if there is already-set user's value.
  • [SIGN-975] - If envelope is with status completed, the URL in embed popup should lead to signed envelope.
  • [SIGN-976] - Signature 1: Incorrect behavior of tab key in signing screen.
  • [SIGN-978] - Signature 2: Ensure that if error is returned from the web service, the corresponded error message will be displayed.
  • [SIGN-979] - Extend audit logging to log send and sign events.
  • [SIGN-982] - Cleanup code in the signature 1 and signature 2 controllers.
  • [SIGN-984] - Forms: Incorrect document displayed after signing.
  • [SIGN-985] - Incorrect full name calculation.
  • [SIGN-986] - CreateSignatureTemplate multiple issues.
  • [SIGN-987] - AddSignatureTemplateRecipient returns null in template identifier.
  • [SIGN-988] - Signature 1: Broken layout in templates dashboard if there are no any templates.
  • [SIGN-989] - DeleteSignatureTemplateDocument raises error.
  • [SIGN-990] - Upload file in create template wizard fails.
  • [SIGN-991] - Signature 2: After confirm signing, the user is redirected to login screen if not logged in before.
  • [SIGN-992] - After the envelope is sent, the owner is included as signer even if it was not set as signer while preparing the nvelope.
  • [SIGN-993] - UpdateSignatureFormFromTemplate raises error.
  • [SIGN-994] - Typo in signature envelope API methods.
  • [SIGN-996] - The final email notification for signed envelope is not send at all.
  • [SIGN-997] - The owner of the envelope could not see the signed documents if he is not in the signers list.
  • [SIGN-1000] - Embed signature is not working in IE8.
  • [SIGN-1001] - Document viewer in signature 2 throws javascript error.
  • [SIGN-1002] - After envelope deletion, files associated with the envelope are staying.
  • [SIGN-1003] - After template deletion, files associated with the template are staying.
  • [SIGN-1004] - After form deletion, files associated with the form are staying.
  • [SIGN-1007] - Replace using of GetTempFileName with GetRandomFileName.
  • SIGN-1013] - Signature 1: Audit log layout is broken.
  • [SIGN-1017] - Signature 1: Embed sign: Always shows the error popup, even if no error.
  • [SIGN-1020] - Notification emails are not send to the recipient with role CC.
  • [SIGN-1021] - Change the title of the audit log popup.
  • [SIGN-1022] - Signature 2: Javascript error in the signed envelope page.
  • [SIGN-1031] - Do not include the recipients that have role canSign false at the last page of the signed document.
  • [SIGN-1033] - Fixes in embed signing.
  • [SIGN-1034] - Signature template API: fields should not be assigned to the recipient with role CC.
  • [SIGN-1036] - Fix the viewer in signature 1.
  • [SIGN-1037] - Signature 2: Embed sign screen shows start button on each page.
  • [SIGN-1038] - Signature 2: Embed signed screen is not working in IE 8.
  • [SIGN-1039] - All dashboards in signature do not work IE8.

GroupDocs Comparison

GroupDocs Comparison is an online document comparison app that allows you to easily compare documents online. This way, you can monitor changes, consolidate different document versions and confirm that your documents are up to date. GroupDocs Comparison combines the two documents and highlights the difference in redline.

Features Implemented

  • [DOCOMPARE-200] - Embeddable comparison result.

Improvements

  • [DOCOMPARE-211] - Confirm and embed dialog design update in comparison 2.

Bugs fixed

  • [DOCOMPARE-202] - Doc files comparison fails when there are embed images and ole objects.
  • [DOCOMPARE-204] - After first comparison, the GetChanges method is called multiple times.
  • [DOCOMPARE-205] - Can't load the output document after comparison is completed and the UI is blocked.
  • [DOCOMPARE-206] - Add embed button in comparison 2.
  • [DOCOMPARE-208] - Fixing issues in comparison 2 embed link generation and display.
  • [DOCOMPARE-212] - Comparing two different docx files fails.
  • [DOCOMPARE-213] - Comparing simple Excel files fails.
  • [DOCOMPARE-214] - Comparing pdf files fails.
  • [DOCOMPARE-215] - Comparing html files fails.
  • [DOCOMPARE-216] - Calling job-output API method with empty or null jobId should not be possible.
  • [DOCOMPARE-217] - Comparison 1: After the comparison completion, the results are not displayed.
  • [DOCOMPARE-219] - Comparison viewer not working because of changes in the viewer adapter.

Platform

Features Implemented

  • Major
    • [CORE-859] Asynchronous PDF to XML conversion.
    • [CORE-858] Reusable file open dialog.
    • [CORE-873] Web hook trigger for the document viewing job.
  • Minor
    • [CORE-885] Integration with Aspose forums.

Bugs fixed

  • Critical
    • [CORE-884] Multiple instances of explorer plug-in do not work on the same page.
    • [CORE-892] Server-side processing fails for non-pdf file formats.
  • Minor
    • [CORE-853] Custom-embedded logo cannot be reset.

Dashboard

Features Implemented

  • Major
    • [CORE-831] Document post-upload processing indicator.

Bugs fixed

  • Major:
    • [CORE-840] Google Cloud. Dashboard convert redirects to null.
    • [CORE-882] "Upgrade" link points to old profile settings page.
  • Minor
    • [CORE-733] Folder lacks "Archive" context menu entry.
    • [CORE-793] Context menu for the last file is not full visible.
    • [CORE-844] Dashboard. Cannot cancel conversion.
    • [CORE-887] Chrome drag & drop fail to upload multiple files.

API

Features Implemented

  • [CORE-838] Dynabic subscription cancellation event handler.
  • [CORE-833] Pulling document pages image out of a 3rd-party storage.
  • [CORE-865] Generic prices for subscription plans support.
  • [CORE-869] Random file name generation function for storage providers.
  • [CORE-888] Document version number for document page image URL.
  • [CORE-889] Path.GetTempFileName replacement.
  • [CORE-893] Access level validation for file system folders.

Bugs fixed

  • [CORE-855] Large file uploads to Amazon S3 fails.
  • [CORE-866] Cannot upload PDF file.
  • [CORE-837] CSV file cannot be viewed.
  • [CORE-839] Update account user method creates users those already exist in the system.
  • [CORE-861] Number of users is not updated for Enterprise subscriptions.
  • [CORE-864] Thumbnails are not uploaded to Amazon when switching udf-pdf option on/off.
  • [CORE-871] Output document format is wrong for assembly jobs.
  • [CORE-872] Free space is improperly calculated on documents upload.
  • [CORE-387] datasource.remove returns 400 Bad Request
  • [CORE-389] doc.questionnaire.remove returns 400 Bad Request

We'll bring you latest news on "Features & Fixes" upon each new release, so stay tuned!

How to perform Callbacks with GroupDocs PHP SDK

This article explains the basics of using PHP SDK callbacks. In this article I'll use the Convert API. Find information about other methods in the Swagger explorer.

Requirements

We already know how to install the Fatfree framework and prepare for creating the sample from the previous article. So lets start with the magic.

Theory

First of all let's familiarize ourselves with Callback and the logic we will implement.

Callback

A callback is something like "Action" in HTML forms, a URL that will be executed by the server when a job is done. In this article we will use the Convert API and Convert method to convert a file from DOC to PDF. One of parameters of this method is a callback URL.

The logic

  1. User enters data into the form.
  2. The data is transfered by POST to the controller.
  3. The controller processes the received data (converts the file) and writes the user ID and private key to the text file for the Callback handler. After that, the controller returns the converted file GUID to the template.
  4. After conversion, the server calls the callback handler.
  5. The callback handler reads the user ID and private key from text file and makes a request to the Storage API to download the converted file.
  6. At same time that the server calls the callback URL, the template file shows the conversion results in an iframe and sends an Ajax request to the Ajax handler.
  7. The Ajax handler checks the "downloads" folder for the downloaded file. If file is there, handler gets the file name and returns it to the template.
  8. If file was downloaded, Ajax also sends a request to the download file handler to generate the download file dialog.

Practice

Now we must create our files:

  • The first file is the template file in the template folder.
  • The second file is the controller which is saved to the inc_samples folder.
  • THe other two files live in the callbacks subfolder in the inc_samples folder.

The structure looks like this:

Figure 11 How to perform Callbacks with GroupDocs PHP SDK

As you can see from screenshot we must create five files:

  1. template.htm
  2. controller.php
  3. convert_callback.php
  4. check_file.php
  5. download_file.php

So let's start in stages.

template.html

In the template folder, create the template.htm file. This file shows the page with the input form and performs an Ajax request. Now put in this code:

 

I will not explain the HTML part of this code since it is a usual HTML document. But we have a JavaScript so let's take a look at that.

First we must include a Jquery library for Ajax requests. This code in the "Head" is responsible for this:

After that we can use Ajax. Now the Ajax code:

 

As Jquery is a JavaScript library we must use the <script></script> tag's. This code starts work 5 sec. after the page is loaded. The delay is necessary in order that the iframe with results is loaded. First of all we must check if this is first time the page is loaded. For this reason we use this check:

After this check, the script shows message and receives all elements from the document. Then the script builds and sends an Ajax request to the check_file controller. When the controller returns the downloaded file name, Ajax sends it to the download_file controller.

controller.php

Now lets do the next step and see what our base controller looks like. In the inc_samples folder, create a file _controller.php file. This file gets form data from the template and makes requests to the Async API to convert the file. Also this controller creates a text file with the user ID and private key for the callback controllers because we can't send this data any other way and the callback controller will be requested only by the server by the callback URL.

Now I'll show you the controller.php code. Put it in:

 

I won't go through the code in detail: each line is explained in the comments. But I'll explain briefly what the code doing.

We have two functions, Convert and delFolder, which do all the work. First of all, we receive POST data from the template and check if all the required fields are filled in. If they are, the controller creates a text file and writes the user ID and private key to it. After that follows the creation of the GroupDocsRequestSigner, APIClient and Async API objects so that we can send request to the API. So we have created all the objects and now we can convert the file. To do this we only need to call the convert method and transfer to it the:

  • user ID,
  • GUID of the file in the GroupDocs account which will be converted
  • callback URL
  • format to convert the file to.

Now we have converted the file but we need the GUID of the converted file and only the job ID is returned from the converted method. No problem, lets take 5 sec. to rest. The 5 sec. delay is necessary so that the inquiry can be be processed. After the delay, we take the returned job ID and make new request to the Async API but now with GetJobDocuments which returns all the info we need by job ID. Now we have the GUID for the converted file and can give this GUID to the iframe URL and return the URL to the template which will use it in the iframe source.

The second function checks the downloads folder for old files and deletes them.

convert_callback.php

Next, let's take a look at the callback controller, convert_callback.php. This file gets the callback from server, takes the data the server sends and downloads the converted file.

This controller reads the user ID and private key from the text file. Then it gets the raw data from the server inquiry. In this raw data we have the job ID. Use this like in the previous controller to get the converted file. To do this we must create all the objects again: GroupDocsRequestSigner, APIClient and Async API. After that we can make a request using the GetJobDocuments method to get the file GUID and name. Use this data for the GetFile method to download the converted file to the downloads folder.

check_file.php

At the same time that the convert_callback controller is working, we see that the page is reloaded and shows the iframe with the converted file. When the iframe is loaded, Ajax sends its request to the check_file controller.

The check_file controller looks like this:

This controller opens the downloads folder and gets all files from it. If there are no files, the controller waits for 5 sec. and checks again. When the file is downloaded and appear in the folder, the controller get the name and returns it to Ajax which sends the file name to the download_file controller.

download_file.php

The download_file generates the download dialog.

Here we take full local path to the downloaded file and transfers it to the download dialog.

Program in action

On that we are finished! Let me show you what it looks like in action:

The input form How to perform Callbacks with GroupDocs PHP SDK

The input form

 

Ajax message How to perform Callbacks with GroupDocs PHP SDK

Ajax message

Iframe with converted file How to perform Callbacks with GroupDocs PHP SDK

Iframe with converted file

 

Download dialog FireFox1 How to perform Callbacks with GroupDocs PHP SDK

Download dialog (FireFox)

Signing Off,

The GroupDocs Marketplace Team

How to Streamline Your Document Signing Using Online Signature?

A steady document signing process is the back bone of any contract-oriented organization. Conventional signing process leaves you with piles of signed documents, difficult to handle and archive. Also, the documents are passed around different departments, either getting lost or eating up too much time delaying the signing process. Online signature is the answer to all these concerns.

Save your time and effort with GroupDocs’ online signature

Say good bye to lost signed documents and tons of paper piling up in your office! Embrace GroupDocs Signature, an efficient online signature service, to streamline your entire signing process. GroupDocs’ online signature service lets you easily prepare & send documents to signers, and collect signatures online.

Get peace of mind by tracking the signing process

Track the document signing process from a centralized location. As soon as the documents are signed, they are automatically archived and available for retrieval when required. This completely avoids the chance of documents getting lost in mountains of signed contracts. In addition, there is no need to follow up your signers regularly through phone calls or emails. You can simply set a reminder while creating a new envelope (while preparing the document for signature) so that the signers get notifications automatically till the reminder expires.

Efficient work flow walks you through the entire process

The work flow for preparing the documents for signing and sending it is so simple that even novice people can do it without the help of any documentation. GroupDocs Signature walks you through the entire process step by step. The workflow is designed in such a way that you go to the next step only after finishing the present one. This will make sure that you perform the process correctly.

Procedure for preparing and sending a document for online signature

Now, lets see the simple steps for preparing a document for e-signature and sending them out to collect signatures:

  1. Go to Signature dashboard and start creating a new envelope.
    Creating a new envelope for e signature8  How to Streamline Your Document Signing Using Online Signature?
  2. Step 1 - Choose a File:

    Here you have three options to choose a file. Use one of them to select your preferred document:

    1. Drag and drop the file in the DROP FILES HERE area.
    2. Use the Upload button and select a file from your computer.
    3. Use the Add from Library button to select a file from your GroupDocs repository.
      Choose a file5  How to Streamline Your Document Signing Using Online Signature?
  3. Step 2 - Add Recipients:

    • Add your signers or recipients here.
      Add recipients7  How to Streamline Your Document Signing Using Online Signature?
  4. Step 3 - Add Info (optional):

    • Add more details to the envelope. You can also add a watermark to your documents. This step is optional.
      Add ifo to the envelope3  How to Streamline Your Document Signing Using Online Signature?
  5. Step 4 - Add Reminders (optional):

    • Add reminder, deadline and document expiry in this step. This too is optional.
      Add reminder deadlines and document expiry4  How to Streamline Your Document Signing Using Online Signature?
  6. Step 5 - Add Fields:

    • Drag and drop fields to the required location on the uploaded document.
      Add signature and other fields to the document2  How to Streamline Your Document Signing Using Online Signature?
  7. Step 6 - Summary (optional):

    • Review the envelope one final time and send the document to the signer(s).
      Review the envelope on final time and send the document to the signers2  How to Streamline Your Document Signing Using Online Signature?
    • The signers can then easily sign documents online just using a browser. Type, draw, or upload the signature.
      Type draw or upload your signature2  How to Streamline Your Document Signing Using Online Signature?

All related partied are notified as soon as the documents are signed.
Stay tuned for a step-by-step video tutorial on how to prepare and send a document for online signature, it's in the pipeline. So why wait! go green with this efficient e-signature service.

How to Compare Files with GroupDocs PHP SDK

This article explains the basics of using PHP SDK classes and methods. In this article I'll use the Comparison API and show how to compare two documents from a GroupDocs account. Find information about other methods in the Swagger explorer.

Requirements

We already know how to install the Fatfree framework and prepare for creating the sample from the previous article. So lets start with the magic.

Sample Creation: Creating the Template

Create a template file in the template folder and name it Comparison.htm. This generates a web page with a form for entering the necessary data such as user ID, private key and the file GUIDs for the two files that will be compared. The user can also enter a callback URL. How to get this data you can find out in the documentation.

The Template Code Explained

This code block shows the data the user entered. Here you can see code like this: \{\{@userId\}\}. In the Fatfree framework you must call a variable declared in the controller for the template.

The next step in the template file creates a div block with the form for entering data:

Callbacks

Let's explain some key moments for this code. In the Fatfree framework, the form is creation using a simple HTML code which does not need explaining: everything is as usual. But in the value of the input's we transfer the value of variables from the controller - \{\{@userId\}\} - in order that the user data stays in the values when the user clicks Make request.

Also you can see here the input named CallbackURL. In this field, the user can enter a URL which will be executed by the server after the comparison is done. A callback is something like an action for a form. It can be a PHP file which is triggered by the server. All of these fields are required except for the callbackURL field.

Displaying the Comparison Results

The next code block in the template file is:

This div block shows the results of a comparison. As you can see, it's simple HTML too but the iframe source and parameters we get from the controller. As part of the controller operation, we check that all the parameters have been entered. If a parameter doesn't have a value, an error is returned. So, depending on what we receive from the server, we return either the iframe or an error message.

The form looks like this:

form How to Compare Files with GroupDocs PHP SDK

Sample Creation: Creating the Controller

Go to the inc_samples folder and create controller file called Comparison.php.

This file will contain this code:

The Controller Code Explained

Now the code explanation:

First of all we must get a posted data from form. In Fatfree framework we can do it with this code:

F3::get is a framework method to call to the global associative array of variables passed to the current script via the HTTP POST method.

Now we can declare empty variables for template.

f3::set is one more framework method similar to f3::get but it transfers data to the template. The first parameter is a name of a variable in the template. The second parameter is the data that associated with this variable. Right now, it's a empty string.

Creating the Compare Function

Let's create a function named Compare which takes the entered data and runs a comparison. First, what this function does is to check that all data has been entered by the user:

The checks are standard checks for empty values.

If the user entered all the required data, the controller continues its operation:

This block sets data to the template variables userId and privateKey, which was empty. After that they contain user entered data.

Next create the Signer, ApiClient and Comparison API objects for making request to the server.

The Comparison

And now the comparison magic:

Expected the comparison segment to be bigger? Sorry if you're disappointed. The document comparison is only one line of code: all you need to do is call the Compare method from the PHP SDK and transfer the proper data to it. Data such as the client ID (user id), the GUIDs for the two files that will be compared (the source and target file IDs) and, finally, the callback URL which can be an empty string.

The next step is a check of the comparison results:

Here we check what status of request was returned.

If it's "Ok", we can continue and get all the necessary data for an iframe, such as result file GUID, from the returned job ID.

In the server response of the Compare method, we have only the request status and job ID which is why we must create an AsyncApi object ($asyncApi = new AsyncApi($apiClient); and call the GetJobDocuments method from this object. This method uses the job ID to get all the info of this job.

Now we must check the job status from $jobInfo->result. If it is "Completed" or "Archived", all is well and we continue. But before we do this check we must allow the server to fulfill the inquiry having established a delay in 5 sec: sleep(5);.

After job status check, we can get the result file GUID. It will be in the outputs array: $guid = $jobInfo->result->outputs[0]->guid;.

So now we have real file GUID and we can generate an iframe: $iframe = 'https:**//apps.groupdocs.com/document-viewer/embed/' . $guid . ' frameborder="0" width="800" height="650"';

Calling the Function

And one last code block:

In this block we call our function with user data and a catch exception (in case there is an exception). The exception contains all possible errors. And we can set variables for the template and send them to it: f3::set('sourceFileId', $sourceFileId);.

As I've already mentioned, this sets variables for the template and this line of code, echo Template::serve('comparison.htm'); calls template and send data to it.

The iframe, complete with results, looks like this:

iframe1 How to Compare Files with GroupDocs PHP SDK

With this, I am finished. That is all. Peace.

 

 

 

 

 

 

 

 

Signing Off,

The GroupDocs Marketplace Team

How to Create GroupDocs Plugin for Contao CMS

This article explains the basics of creating a plugin for the Contao CMS using the Contao Viewer plugin as an example. You can download the completed plugin from Contao.

Requirements

  • Contao CMS
  • PHP 5.3
  • JavaScript

Preparation

To create a GroupDocs Viewer plugin for Contao CMS:

  1. Install Contao CMS. The installation of this CMS is a simple.
  2. Allow GroupDocs <iframe> to appear go to Admin > Setting > Security settings > Allowed HTML tags and just add <iframe> at the end.
  3. Create a folder to hold future plugin files in the root/system/modules directory of the Contao CMS installation and name it groupdocs_viewer.

Creating the Plugin

This plugin adds a button to the Admin side of the CMS above the editing block of any article. When users click the button a dialog appears. Here, users enter the file GUID from their GroupDocs account to embed and iframe with this file.

OK. Let's start creating a Viewer plugin. All operations are in the groupdocs_viewer folder.

First of all, create a ModuleGroupdocsViewer.php file. This file will contain the plugin's installation and uninstallation logic. Enter this code into the file:

The Code Line by Line

Let's take a look at the code we inserted.

The first line

says that if TL_ROOT has not been defined, the user can't access the file. This line must be in all plugin files as first line.

The next, commented, block contains information about the plugin.

Now create a basic class of our plugin which will extend the Contao CMS's Module class. This is necessary for Contao to understand that this is a module and give us access to the CMS's functions.

That creates the class. Then we have the magic that installs and uninstalls the plugin. For this purpose we create some functions. All code explanations are on the same lines of the code in the section below.

So far, we've created the basic plugin file but the plugin doesn't do anything yet. So let's add some functionality.

Completing the Plugin Declaration

Before adding functionality to the plugin, we need to set up some files and file structures.

  1. First, create a Template folder and add an empty template file to it. The Contao CMS will write data that we declare for the template to this file. The file name for is mod_groupdocsviewer - the same that we called our protected variable.
  2. Create a languages folder in the plugin's root folder and, in this folder, create one an en folder. In the enfolder, create two files which will contain a string declaration of all titles and messages for our plugin.Image 1 GD Viewer tree structure How to Create GroupDocs Plugin for Contao CMS

modules.php

The first file is named modules.php and contain basic data such as the plugin name:

As you can see, even in language files there has to be a plugin info block and a line of code that limits access. So in this file we have only one line of code which declares an array with the plugin name and transfers it to the CMS's global data.

tl_gdv.php

The second language file is named tl_gdv.php and contains all local names, titles and messages for our plugin:

Remember that all data is declared as arrays and transferred to the CMS's Global arrays. Also in this file we have JavaScript code which gets a list of sidebar elements and adds links to our plugin details:

You must write the JavaScript code as a simple text by using the 'echo' command. Also in this language file we declare all dependences and includes such as icons etc. That's the last step of the plugin declaration. Now we will add some useful functionality.

Adding Functionality

    1. Create three folders: html, config and dca.
    2. Place an icon .gif file, 16x16 pixels, in the html folder. That's all we need to do with the html folder.
    3. In the dcafolder, create two files:
        1. .htaccess
        2. tl_gdv.php

htaccess

That's all. This code gave access to this folder from ather web pages of Admin side where user can bee.

tl_gdv.php

The code for the second file:


This second file is a copy of the language file with the same name - tl_gdv.php. We do this in order that Contao CMS will have access to this file from any Admin side page where user edit the content of this page.

The Config Folder

The most important and interesting files are placed in the Config folder:

    • .htaccess
    • config.php
    • database.sql
    1. Create these three files in the config folder.
    2. The .htaccess file is a copy of .htaccess file created in the dca folder. We need this file here for the same purposes.
    3. The config.php file contains all the plugin's usefull logic. You'll find the code below.

As you already know, we have the basic plugin info block. Then let's take a look at the code. This block inserts the icon file:

Contao uses the TinyMCE editor so we can use this as the starting point to get the position for where to place our button, and recognize if a user turns on page editing or not. Here is the code: