1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using Paroxe.PdfRenderer;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PdfManager : BaseFilePrefabItem
- {
- private PDFViewer pdfview;
- public override void Init(FileConfig fileConfig)
- {
- base.Init(fileConfig);
- if (!string.IsNullOrEmpty(fileConfig.Url))
- {
- string url = fileConfig.Url;
- //LangChaoRommMinIo.Instance.getFile(MQTTManager.Instance.roomId, fileConfig.Bucket, fileConfig.ObjectName, (RoomFileData rfd) => {
- // Debug.Log("rfd==>" + rfd.url);
- // Debug.Log("rfd==>" + rfd.bytes.Length);
- // url = rfd.url;
- //});
- if (!fileConfig.Url.Contains("http"))
- {
- url = "https://" + fileConfig.Url;
- }
- showPDF(url);
- }
- }
- public void showPDF(string url)
- {
- //this.transform.localPosition = new Vector3(0,0,0.69f);
- pdfview = this.GetComponent<PDFViewer>();
- pdfview.FileURL = url;
- pdfview.LoadDocument();
- }
- public override void OnScaleStopped()
- {
- if (transform.localScale.x < 0.0001f)
- {
- transform.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
- }
- }
- }
|