rwilson504 / PCFControls

Reusable PowerApps Control Framework (PCF) controls.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error

Racheli86 opened this issue · comments

Hey there all,
After I click the download button, it downloads the file but an error occurs:
Error
Failed to load PDF document.
Maybe something in the properties?
Thanks

Can you please answer the following questions so I can try to provide some support.

  • What component in this library are you trying to use?
  • Are you using it in a Canvas or Model application?
  • What is your goal your trying to accomplish using the control?

Thanks,

Rick

Hey,
Thanks for replying.
I'm trying to use download canvas file.
As for the second question am not sure what to answer... I'm in power apps of course and I chose tablet layout...
What I'm trying to do is that:
In my company, we are making a system where the customer will be able to build a blueprint.
The blueprint made of small shapes, which means that there are many images.
After the blueprint is ready we would like to download it as pdf.
We've tried "PCF Screenshot" but it didn't capture the images...
Now I'm trying your PCF maybe I'll be able to send the blueprint screen to pdf download?
If you have any idea how can I download the blueprint or a bunch of images or transfer them to share point (we also tried that and the image didn't appear).
We are on this for a couple of weeks, so it would be great if you could help us.
Thanks in advance,
Racheli

"I chose tablet layout..." this means that you are in a Canvas app.

This blueprint that you are building. How is that being built? Do you have several Image controls on the app?

The download control was designed to download a file where you already have the contents (Blob/Base64). Say for instance you have an Image control on your app you could then download that image, or if you generate a PDF using Flow (Power Automate) you could return that PDF data and then allow for download of the data. It will not take a screenshot of the control and allow you to download that.

Here is an example of how I'm using it. I have a Flow that generates a PDF and returns the file contents back to PowerApps. I then can take those contents and create a download button which allows me to get that information as a downloaded files. Again it's not creating a PDF just downloading the file to my computer using the PDF that has been generated through Flow.

image

Hey @rwilson504,
I'm a bit confused...
I have succeeded download a PDF but couldn't open it.
So what now shall I do?
Thanks for your help.

@Racheli86
I went back yesterday though the Download component and saw that there might be a bug affecting your use of it.

Can you please install the most recent version of the Download component on your environment. After you have installed the solution please open your app in the Editor and make sure to select the Upgrade component option when you are asked. Then save the app and re-publish it.

Can you please send me a link of the recent version?
Thanks

This link will always provide the newest version. Click Here to Download Latest

The newest release can also always be found on the GitHub page for the controls.

image

Hey @rwilson504 ,
That's what I'm getting:
image
That's what I did:
The Button:
image
The raw! :
image

Do you see anything wrong there?
BTW, I tried to write the properties as in the example but powerapps don't let me.
Thanks

You fileContents are not a PDF file just a text string. You need to take a pdf file you already have and encode it using an online tool like the one here, https://base64.guru/converter/encode/file

I would then put that string in a Variable within your canvas app and then set the fileContents to that variable.

image

Again that would just be for testing, whatever PDF files you are planning on showing need to be converted to base64 before you put them in the fileContents. Luckily CDS Notes are already stores in base64 so that one is easy. For other data sources you may need to use the JSON function in canvas to get the base64 contents.

So, this PCF is only for an exciting PDF?
If I want to create PDF from the canvas app, can I?

Hey @rwilson504 ,
I would like to create a PCF on my own.
I would like to create a control that will allow the user to bind images and download the image (that contain the all images) to pdf (that's why I was rting to use your PCF), by button click.
I know JS, HTML, Angular, Python.
Do you think it is possible? or it's complicated?
I'll appreciate for any advice!
Thanks in advanced :)

@Racheli86 You are correct this PCF control is just for downloading files it does not actually generate a PDF for you.

As far as building your own there are some great references out there. All the technologies other than Python you mentioned will help you out. You will also need to understand Typescript too but that can be a fun learning adventure and if you are not using it yet for JS you should be.

Here are some links to get you going.

Start by going here https://docs.microsoft.com/en-us/powerapps/developer/component-framework/overview
This is the Microsoft page for PCF. It has all the info you need on getting started as well as Sample controls.

Here is an example of one for Angular, https://docs.microsoft.com/en-us/powerapps/developer/component-framework/sample-controls/angular-flip-control

Here is an example that is built for Canvas, https://docs.microsoft.com/en-us/powerapps/developer/component-framework/sample-controls/data-set-component-canvas

Also make sure to check out PCF Gallery to see all the other controls people have posted. Don't forget that these controls have links to their GitHub repositories so you can see how they build it or if you find one close enough to what you like you can just fork their repository and modify it to your hearts delight. https://pcf.gallery/

Last and certainly not least is PCF Builder - This is a XrmToolbox plugin that allows you to easily create and deploy PCF projects. It also allows you to quickly install the PCF Command Line Interface.
https://www.xrmtoolbox.com/plugins/Maverick.PCF.Builder/

Thanks @rwilson504 !
It really helped me.