#PDF LOAD ON HTML WITH BACK END. (RED.PDF/ GREEN.PDF/ YELLOW PDF.)

41 messages · Page 1 of 1 (latest)

ebon plume
#

GOAL: there a form. when i type red and submit it will load red pdf. when i type green i will load green pdf. yellow blue so on

cerulean belfry
#

SO

#

Do you need help with the coloring system im assuming?

ebon plume
#

no its a file load in keyword

#

let me show u a example

#

i have else file on my pc

cerulean belfry
#

ok

ebon plume
#

when i type the name it will load the pdf ember on html

#

in order to work u need to make a script on backend

#

post and get.

cerulean belfry
#

ok

#

i think i understand

ebon plume
#

right now i already at halfway

#

i recived any info on backend

cerulean belfry
#

Ok

#

afk rq i need to figure something out

ebon plume
#

i already helped u on half ans

#

i asked the javamastry server they are (selfish. only help themself. call themself master. random ban people whos unfit) fake

atomic sphinx
#

Looks like you already know how to read the file, you just need to pass the bytes back to the front-end now right?

ebon plume
#

correct

#

the file has to output on the iframe

atomic sphinx
#

One way I've done that in the past is by serialising the bytes as base64 and sending it to the front-end in the HTTP response.

ebon plume
#

do u want the example file i can sent to u

atomic sphinx
#

Nah, don't really need it.

#

What I can think of:

  • validate the user input,
  • grab the file from fs,
  • serialise it to base64 (nodejs might do this for you),
  • respond with the value,
  • modify the iframe src attribute to be data:application/pdf;base64, bytes... where bytes... is the value you returned from the back-end
#

Not the best way but it'll work.

#

If these are stored as assets that the front-end can directly access, I don't see any reason why you can't just avoid the back-end entirely though.

ebon plume
#

i have to be backend postion. cuz hiding thoses file in server.

atomic sphinx
#

You could also provide a path to file in the response. Then the front-end requests from that in the iframe.

That will require you to tell the client how to read your PDF via content headers.

#

Really not sure exactly what you're trying to build overall so I'm just going off what I've got.

ebon plume
#

what if i put alot pdf on that front end like thousand of pdf on front end. no issue load time?

atomic sphinx
#

Not until you load the pdf

#

Might be some initial startup time on the web server depending on implementation

#

You can always benchmark it if you need to.

ebon plume
#

@atomic sphinx i am able to load my pdf html with back end without base64

ebon plume
#

the link was issue. but the output pdf was correct

ebon plume