Converting Image to PDF continued

Continuing the discussion from Converting image to pdf:

What I’m trying to do:

I am trying to follow the steps in recommended in the linked post, but can’t seem to figure it out.

What I’ve tried and what’s not working:
I have tried to methods that both seem to be incorrection
method 1:

  def button_2_click(self, **event_args):
    """This method is called when the button is clicked"""
    file = self.file_loader_1.file
    pdf = BlobMedia("application/pdf",anvil.media.open(file),"new_test.pdf")
    anvil.media.download(pdf)

method 2:

  def button_2_click(self, **event_args):
    """This method is called when the button is clicked"""
    file = self.file_loader_1.file
    pdf = BlobMedia("application/pdf",file.get_bytes(),"new_test.pdf")
    anvil.media.download(pdf)

Clone link:
share a copy of your app

I feel as though I am missing something obvious due to ignorance. If I could be enlightened, that would be awesome!

I was WAY off.

Here is a tutorial :slight_smile:

1 Like