Another Google Drive Question - exportType PDF

Another Google Drive Question - exportType PDF

by John Banner -
Number of replies: 11
So I was looking at the code for Google Drive, if I created a new plugin based on the Google Drive plugin and changed the code like so,

Current Code:

case 'document':
                            $title = $item['title'] . '.rtf';
                            $exportType = 'application/rtf';
                            break;


Change Code To:

case 'document':
                            $title = $item['title'] . '.pdf';
                            $exportType = 'application/pdf';
                            break;

The new repository would upload the google document as a PDF to Moodle allowing the teacher to use the PDF marking.

Is it as simple as changing the code?

John


Average of ratings: -
In reply to John Banner

Re: Another Google Drive Question - exportType PDF

by Rob Johnson -

If you change rtf to pdf in that code, it works as expected.  That said, please see this post about trouble once the Google generated PDF loads into the assignment annotation plugin.  My experience documented there was with Moodle 2.4.  I just upgraded to the latest 2.6 yesterday, but have not tried out the Google PDF in the annotation screen.

Edit - I just tried the hack on 2.6, and could not get it to return a PDF.  I wonder if there is more to it than with 2.4.

In reply to John Banner

Re: Another Google Drive Question - exportType PDF

by John Banner -

So I copied the repository and created a new repository plugin for this using the above code changes and it works as expected. The gdoc is imported into Moodle as a PDF!

The only issue I have with it is that since the Document is Landscape the Moodle PDF annotation is displaying the PDF in portrait mode thus cutting off half of the document.

How can it be set so that the PDF annotation properly detects the page size? Or how can we add scrollbars to the PDF editor? Maybe zooming?

As for Rob, I read your posts and I am not sure why your text ends up being so small. When I tested it out the generated PDF looks exactly like it should.

Thanks,

John

In reply to John Banner

Re: Another Google Drive Question - exportType PDF

by John Banner -

I installed this plugin set,

https://moodle.org/plugins/browse.php?list=set&id=29

And it correctly identifies landscape vs portrait so it is working using that plugin! This is great!

Should a bug be filed for the built in PDF editor or has one already been filed for landscape documents?

Thanks,

John

In reply to John Banner

Re: Another Google Drive Question - exportType PDF

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Tracker issue is already there: https://tracker.moodle.org/browse/MDL-43462

Please note that I do not intend to keep maintaining my PDF annotation plugin in the long term, now that the functionality from it has been integrated into Moodle core. There is (currently) no migration path for assignments created using my version, to the core version (but this does not stop you creating new assignments in the core version, at a later date).



In reply to Davo Smith

Re: Another Google Drive Question - exportType PDF

by Rob Johnson -

Hi Davo,

Forgive a silly questions, but where do we find the core version?  I recently upgraded from the 2.4 branch to 2.6.4.  I saw the PDF assign type referenced during the upgrade, but I don't see settings for it when creating an assignment.

In reply to Rob Johnson

Re: Another Google Drive Question - exportType PDF

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There are no settings for it (except for at the system level, to set it up in the first place) - just get a student to upload a PDF and 'launch pdf annotation' appears when grading it.

In reply to Davo Smith

Re: Another Google Drive Question - exportType PDF

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Demo of where to look here:


In reply to Mary Cooch

Re: Another Google Drive Question - exportType PDF

by Rob Johnson -

Thank you to both Davo and Mary.  On one site, I have installed the plugin along side the new core function.  If I remove the plugin, will it cause any loss of functionality with existing assignments?

In reply to John Banner

Re: Another Google Drive Question - exportType PDF

by Rob Johnson -

Thank you for the feedback John.  It has been months since I posted about the PDF size.  Maybe something has changed on the Google side.  I will test further.