PdfManager.cs 998 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Paroxe.PdfRenderer;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class PdfManager : BaseFilePrefabItem
  7. {
  8. private PDFViewer pdfview;
  9. public override void Init(FileConfig fileConfig)
  10. {
  11. base.Init(fileConfig);
  12. if (!string.IsNullOrEmpty(fileConfig.Url))
  13. {
  14. string url = fileConfig.Url;
  15. if (!fileConfig.Url.Contains("http"))
  16. {
  17. url = "https://" + fileConfig.Url;
  18. }
  19. showPDF(url);
  20. }
  21. }
  22. public void showPDF(string url)
  23. {
  24. //this.transform.localPosition = new Vector3(0,0,0.69f);
  25. pdfview = this.GetComponent<PDFViewer>();
  26. pdfview.FileURL = url;
  27. pdfview.LoadDocument();
  28. }
  29. public override void OnScaleStopped()
  30. {
  31. if (transform.localScale.x < 0.0001f)
  32. {
  33. transform.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f);
  34. }
  35. }
  36. }